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 ) ) {