Hi all,

I'm going to be heading out town tonight and will be gone for the next two 
days, but don't take my silence to mean that I've dropped this.  I have started 
on the TAP::Parser module and have the lexer *mostly* working.  There are a 
couple of extra tests I need to write for it and it will be done.  Also, 
because the grammar itself will be context-free, much of the "awareness" of the 
parser is being pushed into the lexer (for example, it croaks if it finds more 
than one plan).
 
Because we're discarding anything which does not look like a plan or a test 
line, the following:

  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 ...

Currently there are some assumptions I'm making, some of which I think are 
wrong.

1.  The lexer croaks() if the planned tests and the actual tests don't match.  
I assume this behavior should be handled elsewhere?
2.  Croaks if numbered and non-numbered tests are mixed:

   ok 1 - This is a test.
  ok  This is only a test
  not ok 3 - Had this been an actual emergency ...
  ok still don't have a number

3.  Croaks if the tests are numbered but the numbers are out of sequence.
4.  Croaks if planned tests are a test number are less than one.

Questions:

1.  Are non-integers allowed for test numbers?  I know this has been proposed 
for groups of tests.
2.  Is there a plan at some point to allow for test failure output to be 
officially incorporated in TAP?  I know we discard that *now*, but in the 
future, people with a GUI are going to want to click on a failure and see:

  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'
 
Instead of:

  not ok 3 - No more info, sucks to be you.

Next, what interface do you want?  I'm thinking something like this:

  my $parser = TAP::Parser->new({
    newlines => 1, # add newlines to output
    version => $optional_version_number
  });
  $parser->parse($tap); # croaks if it can't

  print $parser->plan;
  foreach my $line ( $parser->test_lines ) {
    print $line;
  }
 
I'm sure there's more information I can capture and provide for you, so tell me 
what you want (if I can easily provide it, I will).

Cheers,
Ovid

-- If this message is a response to a question on a mailing list, please send 
follow up questions to the list.
 
Web Programming with Perl -- http://users.easystreet.com/ovid/cgi_course/



Reply via email to