Some of you may be happy to know that I've started writing TAP::Parser and should have an alpha out soon. I'll be out of town through Thursday, so that will put it on hold, but I have much of the core done.
Because of the nature of what I am parsing, a lot of semantic information is being pushed into the lexer itself and anything which is not a test plan or test line is discarded. So this:
TAP version 1 1..3 ok 1 - This is a test. ... and bogus info ok 2 - This is only a test # this will be discarded !!! More garbage! not ok 3 - Had this been an actual emergency ... # Failed test 'Had this been an actual emergency ...' # in foo.t at line 5. # got: '42' # expected: 'answer'
Gets reduced down to the following:
1..3 ok 1 - This is a test. ok 2 - This is only a test not ok 3 - Had this been an actual emergency ...
Yes, that means diagnostic and test failure information goes straight to /dev/null and no, I'm not happy with that either. Those, however, are my marching orders. Subscribe to the Perl QA list for more information as to why that is.
Thanks,
-Dom
Re:Funky!
Ovid on 2006-07-04T14:27:20
Ah, cool. My first customer
:) The interface will probably look something like this:
my $parser = TAP::Parser->new($optional_version_number);
$parser->parse($tap); # croaks on bad TAP
print $parser->plan;
while ( my $test = $parser->tests ) {
print $test->as_string;
# or
print $test->is_ok; # boolean value
print $test->ok; # 'not ok' or 'ok'
print $test->number;
print $test->description;
print $test->directive; # TODO or SKIP data
}I'll be out of town for the next couple of days celebrating a brother's graduation (and later recovering from said celebration), but I hope to return to this soon. It looks much easier than I thought, but the lexer tests took a while. Feature requests welcome.
Re:Funky!
Dom2 on 2006-07-04T15:59:36
Don't get too happy -- it's still in the thought stage over here. But I'll let you know when it gets down to some code...-Dom
Re:Funky!
Alias on 2006-07-04T16:39:30
See Schwern!
I TOLD you we should have just gone with SAX itself as an event model:)
In any case, it should hopefully be easy to move between the two.