doc: typos in test file.
[automake.git] / t / tap-passthrough.sh
bloba968e22ab038804abecc7ea5cacb1489ca063d8e
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 # - all input (valid TAP lines, invalid TAP lines, non-TAP lines)
19 # are passed through in the log file
20 # - TAP errors are reported in the log file too
21 # See also related test 'tap-passthrough-exit.sh'.
23 . test-init.sh
25 weirdchars=\''"\$@!&()[]<>#;,:.^?*/'
27 . tap-setup.sh
30 # Only successful tests.
33 # The whitespace in this test might be normalized in the testsuite
34 # progress output, but should be copied verbatim in the log files.
35 cat > ok.test <<END
36 1..6
37 TAP plan in the previous line.
38 ok${tab}
39 ok 2
40 ok - foo
41 ok 4 - x
42 This is not a TAP line, but should still be copied in the log file!
43 # some diagnostic${tab}
44 not ok # TODO low priority
45 ok # SKIP who cares?
46 $weirdchars
47 END
49 run_make TESTS=ok.test check || { cat ok.log; exit 1; }
50 cat ok.log
52 for rx in \
53 '1\.\.6' \
54 'TAP plan in the previous line\.' \
55 "ok${tab}" \
56 'ok 2' \
57 'ok - foo' \
58 'ok 4 - x' \
59 ' This is not a TAP line, but should still be copied in the log file!' \
60 "# some diagnostic${tab}" \
61 'not ok # TODO low priority' \
62 'ok # SKIP who cares?' \
63 ; do
64 grep "^$rx$" ok.log
65 done
66 $FGREP "$weirdchars" ok.log
69 # Mixed failing/successful tests.
72 cat > tiny.test <<END
73 1..1
75 END
77 cat > ok.test <<END
78 1..1
80 only one success here
81 END
83 cat > ko.test <<END
84 1..5
85 foo foo foo
86 ok${tab}
87 ok 2
88 not ok - foo
89 not ok 4 - x
90 # diagnostic ko
91 bar${tab}bar${tab}bar
92 ok # TODO dunno
93 $weirdchars
94 END
96 cat > bail.test <<END
97 Bail out! Test is taking too long!
98 END
100 cat > skip.test <<END
101 1..0 # Skipped: WWW::Mechanize not installed
104 cat > err.test <<END
105 1..3
106 ok 1
107 Invalid test count
108 ok 23
109 Misplaced plan
110 1..13
112 Extra test
114 Last line
117 st=0
118 run_make check \
119 TESTS='tiny.test ok.test ko.test bail.test skip.test err.test' || st=$?
120 cat tiny.log
121 cat ok.log
122 cat ko.log
123 cat bail.log
124 cat skip.log
125 cat err.log
126 test $st -gt 0 || exit 1
128 grep '^1\.\.1$' tiny.log
129 grep '^ok$' tiny.log
130 grep '^only one success here$' ok.log
132 for rx in \
133 '1\.\.5' \
134 'foo foo foo' \
135 "ok${tab}" \
136 'ok 2' \
137 'not ok - foo' \
138 'not ok 4 - x' \
139 '# diagnostic ko' \
140 " bar${tab}bar${tab}bar" \
141 'ok # TODO dunno' \
142 ; do
143 grep "^$rx$" ko.log
144 done
145 $FGREP "$weirdchars" ko.log
147 grep '^Bail out! Test is taking too long!$' bail.log
148 grep '^1\.\.0 # Skipped: WWW::Mechanize not installed$' skip.log
150 for rx in \
151 '^1\.\.3$' \
152 '^Invalid test count$' \
153 '^ok 23$' \
154 '^Misplaced plan$' \
155 '^1\.\.13$' \
156 '^ERROR:.* multiple test plans' \
157 '^Extra test$' \
158 '^Last line$' \
159 '^ERROR:.* [tT]oo many tests run.*expected 3, got 4' \
160 '^ERROR:.* err\.test 23 .*OUT[ -]OF[ -]ORDER.*expecting 2' \
161 ; do
162 grep "$rx" err.log
163 done