tests: avoid spurious failure due to bug in older TAP::Parser
authorStefano Lattarini <stefano.lattarini@gmail.com>
Wed, 7 Sep 2011 17:06:52 +0000 (19:06 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Wed, 7 Sep 2011 17:18:56 +0000 (19:18 +0200)
Older TAP::Parser versions (e.g., 3.10) erroneously convert a test
number `0' into `1'; do not let this bug cause a spurious failure
in our testsuite.

* tests/tap-test-number-0.test: Skip if the aforementioned
TAP::Parser bug is detected.

ChangeLog
tests/tap-test-number-0.test

index 09b6d2a..dfbb90a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2011-09-07  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
+       tests: avoid spurious failure due to bug in older TAP::Parser
+       Older TAP::Parser versions (e.g., 3.10) erroneously convert a test
+       number `0' into `1'; do not let this bug cause a spurious failure
+       in our testsuite.
+       * tests/tap-test-number-0.test: Skip if the aforementioned
+       TAP::Parser bug is detected.
+
+2011-09-07  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
        tap/perl: be more portable to older perl versions
        * lib/tap-driver.pl (trap_perl_warnings_and_errors): Do not use
        the three-args version of the `open' builtin, it is not well
index abce60e..1f7681f 100755 (executable)
 parallel_tests=yes
 . ./defs || Exit 1
 
+if $PERL -w -e '
+  use warnings FATAL => "all"; use strict;
+  use TAP::Parser;
+  my $parser = TAP::Parser->new({tap => "1..1\n" . "ok 0\n"});
+  my $result = $parser->next;
+  $result->is_plan or die "first line is not TAP plan";
+  $result = $parser->next;
+  $result->is_test or die "second line is not TAP test result";
+  my $testno = $result->number;
+  $parser->next and die "unexpected further TAP stream";
+  exit ($testno == 0 ? 0 : 77);
+'; then
+  : # Nothing to do.
+elif test $? -eq 77; then
+  skip_ 'TAP::Parser bug: test number 0 gets relabelled as 1'
+else
+  fatal_ "error analyzing TAP::Parser module for bugs"
+fi
+
 . "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
 
 cat > a.test <<END