--- Shlomi Fish <[EMAIL PROTECTED]> wrote:

> > Test::Run works fine with TAPx-Parser 0.41, but it breaks with the
> > TAPx-Parser from the trunk:

I've figured it out and that's because TAPx::Parser 0.41 was buggy and
the latest TAPx::Parser has found a point where your code differs in
interpretation from Test::Harness.
 
> Replying to myself I'd like to note that from my analysis at least
> the
> bignum test failed because of the following code in the new
> TAPx::Parser:
> 
> <<<<<<<<<
> sub is_ok {
>     my $self = shift;
> 
>     return if $self->is_unplanned;       # <-----------
> 
>     # TODO directives reverse the sense of a test.
>     return $self->has_todo ? 1 : $self->ok !~ /not/;
> }

You noted that the 'bignum' test failed.  Well, let's look at that one:

  print <<DUMMY;
  1..2
  ok 1
  ok 2
  ok 136211425 
  ok 136211426
  DUMMY

If you try and run that through 'prove', you'll get a strange "Can't
detailize, too big" error, so let's keep it simple, with normal tests
but a bad plan:

  $ cat badplan 
  print <<DUMMY;
  1..2
  ok 1
  ok 2
  ok 3 
  ok 4
  DUMMY

And then use 'prove':

  $ prove badplan 
  badplan...FAILED tests 3-4                                           
       
          Failed 2/2 tests, 0.00% okay
  Failed Test Stat Wstat Total Fail  List of Failed
  ------------------------------------------------------------
  badplan                    2    2  3-4
  Failed 1/1 test scripts. -2/2 subtests failed.
  Files=1, Tests=2,  0 wallclock secs ( 0.01 cusr +  0.01 csys =  0.02
CPU)
  Failed 1/1 test programs. -2/2 subtests failed.

Hmm, 2/2 tests failed with 0.00% ok?  Later we get -2/2 subtests
failed?

What does 'runtests' say?  ('runtests' will handle the 'bignum' test
above, too):

  $ runtests badplan 
  badplan.... All 2 subtests passed 

  Test Summary Report
  -------------------
  badplan (Wstat: 0 Tests: 4 Failed: 2)
    Failed tests:  3-4
    Parse errors: Bad plan.  You planned 2 tests but ran 4.
  Files=1, Tests=4,  0 wallclock secs ( 0.00 cusr +  0.00 csys =  0.00
CPU)

That's much clearer.  The problem happens because you've run two more
tests than you planned, so the third and fourth tests are 'unplanned'. 
As a result, the harness has no way of knowing if you have a bad plan
or if you have spurious tests being run.  Hence, running more tests
than you have planned is an error.

Note that 'is_unplanned' is documented to always return false with a
trailing plan because you can't know until you reach the plan (or
never, with an infinite stream) if any tests were unplanned.

I'm also about to commit more tests to guarantee this behavior since it
is documented but not tested well enough.

I hope that explains things.

Cheers,
Ovid

--

Buy the book -- http://www.oreilly.com/catalog/perlhks/
Perl and CGI -- http://users.easystreet.com/ovid/cgi_course/

Reply via email to