Ovid wrote:
> ----- Original Message ----
> From: Michael G Schwern <[EMAIL PROTECTED]>
> 
>>>     foreach $test (11..14) {print "ok $test # skipped on non-VMS system\n"};
>>>
>>> That unescaped hash mark is causing me lots of pain.
>> Because its not an unescaped hash mark.  Its an old school skip directive.  
> 
> Ah, didn't know that.  Thanks.
> 
> However, that still doesn't explain my other example:
> 
>   Regexp-Common-2.120 $ perl t/test_no_import.t 
>   1..3
>   ok 1
>   ok 2
>   ok 3 # $; eq "\034"
> 
> Test::Harness thinks that's just fine.  If the unescaped hash mark was 
> forbidden (as I 
> originally had it), then the last line gets marked as junk 
> (TAPx::Parser::Results::Unknown) 
> and doesn't get counted as a test.  Only by changing my code and deliberately 
> allowing that 
> hash mark was I able to parse Regexp::Common's tests.

The above is still a passing test with a directive.  Its really a miswritten 
attempt at putting a description onto a test similar to what was fixed in Glib.

Test::Harness is pretty permissive in what it allows.  Accepting the above is 
an artifact of the way in which it parses a line.  It first looks for the 
"ok/not ok" and an optional number.  Anything beyond that is considered "extra" 
and handled separately.  So no matter what comes after that "ok 3" its still 
going to record it as a pass.  This is robust.

Moreover, q[ok 3 # $; eq "\034"] is still a passing test with a directive.  The 
directive type is '$;' and the reason is 'eq "\034"'.  Its nonsense, but 
TAPx::Parser should be able to handle new directives without choking.

In regex terms, a directive is simply ($type, $reason) = 
/#\s*(\S+)(?:\s+(.*))?$/.  TAPx::Parser can record the type and reason and move 
along.  You might want to warn about the unknown directive type, but consider 
this would get in the way of adding new directive types.

Either way, TAPx::Parser should be tolerant of nonsense following the simple 
ok/not ok.  It should at least record the basic pass/fail info.

Reply via email to