release: generate a stub for the release announcement
[automake.git] / t / tap-test-number-0.sh
blobf36034930cfc1abae2e73907bbe45dcdabee39e7
1 #! /bin/sh
2 # Copyright (C) 2011-2012 Free Software Foundation, Inc.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2, or (at your option)
7 # any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17 # TAP support:
18 # - a test result numbered as 0 is to be considered out-of-order
19 # This is consistent with the behaviour of the 'prove' utility.
21 . ./defs || exit 1
23 if test $am_tap_implementation = perl; then
24 $PERL -MTAP::Parser -e 1 \
25 || skip_ "cannot import TAP::Parser perl module"
26 if $PERL -w -e '
27 use warnings FATAL => "all"; use strict;
28 use TAP::Parser;
29 my $parser = TAP::Parser->new({tap => "1..1\n" . "ok 0\n"});
30 my $result = $parser->next;
31 $result->is_plan or die "first line is not TAP plan";
32 $result = $parser->next;
33 $result->is_test or die "second line is not TAP test result";
34 my $testno = $result->number;
35 $parser->next and die "unexpected further TAP stream";
36 exit ($testno == 0 ? 0 : 77);
37 '; then
38 : # Nothing to do.
39 elif test $? -eq 77; then
40 skip_ 'TAP::Parser bug: test number 0 gets relabelled as 1'
41 else
42 fatal_ "error analyzing TAP::Parser module for bugs"
46 . tap-setup.sh
48 cat > a.test <<END
49 1..1
50 ok 0
51 END
53 cat > b.test <<END
54 1..1
55 not ok 0
56 END
58 cat > c.test <<END
59 1..1
60 ok 0 foo # SKIP
61 END
63 cat > d.test <<END
64 1..1
65 not ok 0 bar # TODO
66 END
68 cat > e.test <<END
69 1..1
70 ok 0 # TODO
71 END
73 TESTS='a.test b.test c.test d.test e.test' $MAKE -e check >stdout \
74 && { cat stdout; exit 1; }
75 cat stdout
77 count_test_results total=5 pass=0 fail=0 xpass=0 xfail=0 skip=0 error=5
79 grep '^ERROR: a\.test 0 # OUT-OF-ORDER (expecting 1)$' stdout
80 grep '^ERROR: b\.test 0 # OUT-OF-ORDER (expecting 1)$' stdout
81 grep '^ERROR: c\.test 0 foo # OUT-OF-ORDER (expecting 1)$' stdout
82 grep '^ERROR: d\.test 0 bar # OUT-OF-ORDER (expecting 1)$' stdout
83 grep '^ERROR: e\.test 0 # OUT-OF-ORDER (expecting 1)$' stdout