doc: typos in test file.
[automake.git] / t / tap-todo-skip-whitespace.sh
blob06c7bb3f2dd2cc6566155def68afd244e2a220d4
1 #! /bin/sh
2 # Copyright (C) 2011-2024 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 <https://www.gnu.org/licenses/>.
17 # TAP support:
18 # - normalization of whitespace in console testsuite progress associated
19 # with TODO and SKIP directives
21 . test-init.sh
23 . tap-setup.sh
25 cat > stub.tap <<END
26 1 # TODO
27 2 # TODO foo?
28 3 # TODO: bar!
29 4 aa # TODO
30 5 bb # TODO fnord 5
31 6 cc # TODO:${tab}fnord 6
32 7 - x # TODO
33 8 - y # TODO fnord $tab 8
34 9 - z # TODO: fnord 9 $tab
35 10# TODO x0
36 11$tab# TODO x1
37 12 $tab$tab # TODO x2
38 13 asd# TODO x3
39 14 sad$tab# TODO x4
40 15 das$tab$tab # TODO x5
41 END
43 cat > stub.exp <<END
44 1 # TODO
45 2 # TODO foo?
46 3 # TODO: bar!
47 4 aa # TODO
48 5 bb # TODO fnord 5
49 6 cc # TODO:${tab}fnord 6
50 7 - x # TODO
51 8 - y # TODO fnord $tab 8
52 9 - z # TODO: fnord 9
53 10 # TODO x0
54 11 # TODO x1
55 12 # TODO x2
56 13 asd # TODO x3
57 14 sad # TODO x4
58 15 das # TODO x5
59 END
61 plan=1..15
63 my_make_check ()
65 xpass=0 xfail=0 skip=0
66 case $1 in
67 xpass|xfail|skip) eval $1=15;;
68 *) fatal_ "bad argument '$1' for my_make_check";;
69 esac
70 cat all.test
71 # We don't care about the exit status in this test.
72 run_make -O -e IGNORE check
73 count_test_results total=15 pass=0 fail=0 error=0 \
74 xpass=$xpass xfail=$xfail skip=$skip
75 # Don't be too strict w.r.t. possible normalization of "TODO: foo" into
76 # "TODO : foo" (as is done by, e.g., the 'TAP::Parser' perl module).
77 LC_ALL=C grep '^[A-Z][A-Z]*:' stdout \
78 | sed -e 's/# TODO *:/# TODO:/' -e 's/# SKIP *:/# SKIP:/' > got
79 cat exp
80 cat got
81 diff exp got
84 # For "TODO" directives leading to XPASS results.
85 (echo $plan && sed -e 's/^/ok /' stub.tap) > all.test
86 sed -e 's/^/XPASS: all.test /' stub.exp > exp
87 my_make_check xpass
89 # For "TODO" directives leading to XFAIL results.
90 (echo $plan && sed -e 's/^/not ok /' stub.tap) > all.test
91 sed -e 's/^/XFAIL: all.test /' stub.exp > exp
92 my_make_check xfail
94 # For "SKIP" directives.
95 (echo $plan && sed -e 's/^/ok /' -e 's/TODO/SKIP/' stub.tap) > all.test
96 sed -e 's/TODO/SKIP/' -e 's/^/SKIP: all.test /' stub.exp > exp
97 my_make_check skip