On 7/4/06, Ovid <[EMAIL PROTECTED]> wrote:
Because we're discarding anything which does not look like a plan or a test line

Don't discard them, just pass them through unaltered.  Don't want to
lose any information.  The /^#/ lines should be marked as comments.
Anything else is marked as junk but still passed through.


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?

Doesn't sound like a lexer's job.  Sounds more like the parser's.


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

This is perfectly ok.  A virtual number is assigned.

This would be bad:

ok 1
ok
ok
ok 3

But again, parser's job.


3.  Croaks if the tests are numbered but the numbers are out of sequence.

Also sounds like the parser's job.


4.  Croaks if planned tests are a test number are less than one.

1..0 is a skip all.

Also, parser's job.


Questions:

1.  Are non-integers allowed for test numbers?  I know this has been proposed 
for groups of tests.

It may have been proposed, but it is not currently allowed.


2.  Is there a plan at some point to allow for test failure output to be 
officially incorporated in TAP?

Yes.  It will not be in the form of comments.


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.

They can still see that if you pass the comments through the
lexer/parser unaltered and allow the GUI to do whatever they like with
it.


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

  my $parser = TAP::Parser->new({
    newlines => 1, # add newlines to output

I don't understand what this option would do. What does a parser output?


    version => $optional_version_number
  });
  $parser->parse($tap); # croaks if it can't

What is $tap?  A string?  Then it can't parse a stream like we do now.


  print $parser->plan;
  foreach my $line ( $parser->test_lines ) {
    print $line;
  }

What work is the parser doing here if all you get is the original line
spat back?

Reply via email to