Skip Menu |

This queue is for tickets about the TAPx-Parser CPAN distribution.

Report information
The Basics
Id: 21205
Status: resolved
Priority: 0/
Queue: TAPx-Parser

People
Owner: Nobody in particular
Requestors: geoff [...] laxan.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.12
Fixed in: (no value)



Subject: Uninitialized value warning when no plan found
(I'm testing ang patching against version 0.12.) I tried this on some tests I've been writing, and all was well except for one file, which I hadn't got round to finishing. It produces no output, not even a plan, which is clearly my fault. But TAPx::Parser doesn't produce the best error message for it (this was with the tprove example): t/30job.t......Use of uninitialized value in numeric ne (!=) at TAPx-Parser-0.12/lib/TAPx/Parser.pm line 798, <T_P_S_PERL_FH> line 6. That's because it's comparing the number of tests run (zero) against the number of tests planned (undef). The attached patch makes the error message go away, and tprove reports an error for my null test script, although it also says it's 'ok', so I'm not sure if this is the right solution.
Subject: tap_parser_no_plan.diff
--- lib/TAPx/Parser.pm.orig 2006-08-28 11:06:37.000000000 +0100 +++ lib/TAPx/Parser.pm 2006-08-28 11:06:40.000000000 +0100 @@ -795,7 +795,7 @@ elsif ( $self->_plan_found > 1 ) { $self->_add_error("More than one plan found in TAP output"); } - if ( $self->tests_run != $self->tests_planned ) { + elsif ( $self->tests_run != $self->tests_planned ) { $self->good_plan(0); } if ( $self->tests_run != ( $self->passed + $self->failed ) ) {
Thanks for bringing this problem to my attention. I'm working on a fix now and will be uploading it soon along with some other changes, including an improved callback system. Cheers, Ovid
This bug has been fixed as of 0.20. TAPx::Parser now uses this: if ( $self->tests_run != ($self->tests_planned || 0) ) { $self->good_plan(0); } This might seem odd, but "undef" is a valid response for $self->tests_planned as this could be an infinite stream which somehow terminated early and thus did not have a plan output. tprove now checks for this case and reports a failure. Cheers, Ovid