doc: update Vala documentation
[automake.git] / t / tap-fancy2.sh
blob07d5d2fcbcaa1394ca5915fc15fd46d141e18cc2
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: more unusual forms for valid TAP input.
18 # See also related test 'tap-fancy.sh'.
20 . test-init.sh
22 . tap-setup.sh
25 # From manpage Test::Harness::TAP(3):
27 # Lines written to standard output matching /^(not )?ok\b/ must be
28 # interpreted as test lines. All other lines must not be considered
29 # test output.
31 # Unfortunately, the exact format of TODO and SKIP directives is not as
32 # clearly described in that manpage; but a simple reverse-engineering of
33 # the prove(1) utility shows that it is probably given by the perl regex
34 # /#\s*(TODO|SKIP)\b/.
37 # To avoid problems with backslashes in echo arguments.
38 xecho () { printf '%s\n' "$*"; }
40 # There are 34 values for $str ...
41 for str in \
42 \' \
43 '"' \
44 '`' \
45 '#' \
46 '$' \
47 '!' \
48 '\' \
49 '/' \
50 '&' \
51 '%' \
52 '(' \
53 ')' \
54 '|' \
55 '^' \
56 '~' \
57 '?' \
58 '*' \
59 '+' \
60 '-' \
61 ',' \
62 ':' \
63 ';' \
64 '=' \
65 '<' \
66 '>' \
67 '@' \
68 '[' \
69 ']' \
70 '{' \
71 '}' \
72 '\\' \
73 '...' \
74 '?[a-zA-Z0-9]*' \
75 '*.*' \
76 ; do
77 # ... each of them add 1 pass, 1 fail, ...
78 xecho "ok${str}"
79 xecho "not ok${str}"
80 # ... and (generally) 4 skips, 4 xfails, and 4 xpasses ...
81 for settings in \
82 'result="ok" directive=SKIP' \
83 'result="not ok" directive=TODO' \
84 'result="ok" directive=TODO' \
85 ; do
86 eval "$settings"
87 xecho "${result}# ${directive}${str}"
88 # ... but 6 skips, 6 xpasses and 6 xfails are to be removed, since
89 # they might not work with $str = '#' or $str = '\' ...
90 if test x"$str" != x'#' && test x"$str" != x'\'; then
91 xecho "${result}${str}#${directive}"
92 xecho "${result}${str}# ${tab}${tab} ${directive}"
93 xecho "${result}${str}#${directive}${str}"
95 done
96 done > all.test
98 # Sanity check against a previous use of unportable usages of backslashes
99 # with the "echo" builtin.
100 if grep '[^\\]\\#' all.test; then
101 framework_failure_ "writing backslashes in all.test"
104 # ... so that we finally have:
105 pass=34
106 fail=34
107 xfail=130 # = 4 * 34 - 6
108 xpass=130 # = 4 * 34 - 6
109 skip=130 # = 4 * 34 - 6
110 error=0
111 total=$(($pass + $fail + $xfail + $xpass + $skip))
113 # Even nastier! But accordingly to the specifics, it should still work.
114 for result in 'ok' 'not ok'; do
115 echo "${result}{[(<#${tab}TODO>)]}" >> all.test
116 done
117 echo "ok{[(<#${tab}SKIP>)]}" >> all.test
119 # We have to update some test counts.
120 xfail=$(($xfail + 1))
121 xpass=$(($xpass + 1))
122 skip=$(($skip + 1))
123 total=$(($total + 3))
125 # And add the test plan!
126 echo 1..$total >> all.test
128 run_make -O -e FAIL check
130 $EGREP '^(PASS|FAIL|SKIP).*#.*TODO' stdout && exit 1
131 $EGREP '^X?(PASS|FAIL).*#.*SKIP' stdout && exit 1
133 count_test_results total=$total pass=$pass fail=$fail skip=$skip \
134 xpass=$xpass xfail=$xfail error=$error