3 # Test recognition of Scheme format strings.
6 trap 'rm -fr $tmpfiles' 1 2 3 15
8 tmpfiles
="$tmpfiles f-sc-1.data"
9 cat <<\EOF
> f-sc-1.data
10 # Valid: no argument, ( | . *)
12 # Valid: one argument, (* | . *)
14 # Valid: 11 arguments, (* * * * * * * * * * * | . *)
16 # Invalid: unterminated
18 # Invalid: unterminated
20 # Invalid: unterminated
22 # Invalid: unterminated
28 # Valid: colon and atsign
30 # Valid: atsign and colon
32 # Valid: params before atsign and colon
34 # Invalid: params after atsign and colon
36 # Invalid: params after atsign and colon
38 # Invalid: params after atsign and colon
40 # Valid: V and # params, (i() * | . *)
42 # Invalid: wrong type params
44 # Valid: FORMAT-ASCII, (i() i() i() c() * | . *)
46 # Invalid: too many params
48 # Valid: FORMAT-S-EXPRESSION, (i() i() i() c() * | . *)
50 # Invalid: too many params
52 # Valid: FORMAT-PRETTY, (* | . *)
54 # Invalid: too many params
56 # Valid: FORMAT-DECIMAL, (i() c() c() i() i | . *)
58 # Invalid: too many params
60 # Valid: FORMAT-BINARY, (i() c() c() i() i | . *)
62 # Invalid: too many params
64 # Valid: FORMAT-OCTAL, (i() c() c() i() i | . *)
66 # Invalid: too many params
68 # Valid: FORMAT-HEXADECIMAL, (i() c() c() i() i | . *)
70 # Invalid: too many params
72 # Valid: FORMAT-RADIX, (i() i() c() c() i() i | . *)
74 # Invalid: too many params
76 # Valid: FORMAT-PLURAL, (* | . *)
78 # Valid: FORMAT-PLURAL, (i | . *)
80 # Invalid: too many params
82 # Valid: FORMAT-CHARACTER, (c | . *)
84 # Valid: FORMAT-CHARACTER, ( | . *)
86 # Invalid: too many params
88 # Valid: FORMAT-FIXED-FLOAT, (i() i() i() c() c() r | . *)
90 # Invalid: too many params
92 # Valid: FORMAT-EXPONENTIAL-FLOAT, (i() i() i() i() c() c() c() r | . *)
94 # Invalid: too many params
95 "abc~v,v,v,v,v,v,v,5E"
96 # Valid: FORMAT-GENERAL-FLOAT, (i() i() i() i() c() c() c() r | . *)
98 # Invalid: too many params
99 "abc~v,v,v,v,v,v,v,5G"
100 # Valid: FORMAT-DOLLARS-FLOAT, (i() i() i() c() r | . *)
102 # Invalid: too many params
104 # Valid: FORMAT-FIXED-FLOAT-COMPLEX, (C | .*)
106 # Valid: FORMAT-TERPRI, (i() | . *)
108 # Invalid: too many params
110 # Valid: FORMAT-FRESH-LINE, (i() | . *)
112 # Invalid: too many params
114 # Valid: FORMAT-SPACE, (i() | . *)
116 # Invalid: too many params
118 # Valid: FORMAT-TAB, (i() | . *)
120 # Invalid: too many params
122 # Valid: FORMAT-PAGE, (i() | . *)
124 # Invalid: too many params
126 # Valid: FORMAT-TILDE, (i() | . *)
128 # Invalid: too many params
130 # Valid: FORMAT-FORCE-OUTPUT, ( | . *)
132 # Invalid: too many params
134 # Valid: FORMAT-IMPLEMENTATION, ( | . *)
136 # Invalid: too many params
138 # Valid: FORMAT-TABULATE, (i() i() c() | . *)
140 # Invalid: too many params
142 # Valid: FORMAT-GOTO absolute, (* r c | . *)
144 # Invalid: type incompatibility
146 # Valid: FORMAT-GOTO backward, (* c r | . *)
148 # Invalid: type incompatibility
150 # Invalid: too many params
152 # Valid: FORMAT-GOTO with large number
153 "abc~S~F~S~1000000@*~C"
154 # Valid: FORMAT-INDIRECTION, (~ ( | . *) | . *)
156 # Valid: FORMAT-INDIRECTION, (~ | . *)
158 # Invalid: too many params
160 # Valid: FORMAT-INDIRECTION, (~ ( | . *) | . *)
162 # Valid: FORMAT-INDIRECTION, (~ | . *)
164 # Invalid: too many params
166 # Valid: FORMAT-CASE-CONVERSION, (* | . *)
168 # Invalid: too many params
170 # Invalid: too many params
172 # Invalid: unterminated
176 # Valid: FORMAT-CONDITIONAL, (i() c | . *)
178 # Valid: FORMAT-CONDITIONAL, (i() | . *)
182 # Valid: FORMAT-CONDITIONAL, (* i c | . *)
184 # Invalid: missing separator
186 # Invalid: too many separators
187 "abc~:[~X~;~D~;~E~]~C"
188 # Valid: FORMAT-CONDITIONAL, (* | . *)
190 # Valid: FORMAT-CONDITIONAL, (* i c | . *)
191 "abc~[~D~;~X~:;~R~]~C"
192 # Invalid: default clause not last
193 "abc~[~D~;~X~:;~R~;~R~]~C"
194 # Invalid: too many params
196 # Invalid: too many params
198 # Invalid: too many params
200 # Invalid: too many params
202 # Invalid: too many params
204 # Valid: FORMAT-CONDITIONAL, one param, without colon or atsign
206 # Invalid: too many params
208 # Invalid: too many params
210 # Invalid: too many params
212 # Valid: FORMAT-ITERATION, (( | . *) | . *)
214 # Valid: FORMAT-ITERATION, (( | . ( | . *)) | . *)
216 # Valid: FORMAT-ITERATION, ( | . *)
218 # Valid: FORMAT-ITERATION, ( | . ( | . *))
220 # Valid: FORMAT-ITERATION with indirection, (~ ( | . *) | . *)
222 # Valid: FORMAT-ITERATION with indirection, (~ ( | . ( | . *)) | . *)
224 # Valid: FORMAT-ITERATION with indirection, (~ | . *)
226 # Valid: FORMAT-ITERATION with indirection, (~ | . ( | . *))
228 # Valid: FORMAT-ITERATION with loop, (( | . i c) | . *)
230 # Valid: FORMAT-ITERATION with loop, (( | . (i c | . *)) | . *)
232 # Valid: FORMAT-ITERATION with loop, ( | . i c)
234 # Valid: FORMAT-ITERATION with loop, ( | . (i c | . *))
236 # Valid: FORMAT-ITERATION with variable-advance loop, (( | . *) | . *)
238 # Valid: FORMAT-ITERATION with variable-advance loop, (( | . (* | . *)) | . *)
240 # Valid: FORMAT-ITERATION with variable-advance loop, ( | . *)
242 # Valid: FORMAT-ITERATION with variable-advance loop, ( | . (* | . *))
246 # Invalid: wrongly nested
248 # Valid: any number of arguments
250 # Invalid: type incompatibility between integer and list
252 # Invalid: type incompatibility between real and list
254 # Valid: list must be empty
258 : ${XGETTEXT=xgettext}
260 while read comment
; do
263 tmpfiles
="$tmpfiles f-sc-1-$n.in f-sc-1-$n.po"
264 cat <<EOF > f-sc-1-$n.in
267 ${XGETTEXT} -L Scheme
-o f-sc-1-
$n.po f-sc-1-
$n.
in ||
exit 1
268 test -f f-sc-1-
$n.po ||
exit 1
270 if echo "$comment" |
grep 'Valid:' > /dev
/null
; then
271 if grep scheme-format f-sc-1-
$n.po
> /dev
/null
; then
277 if grep scheme-format f-sc-1-
$n.po
> /dev
/null
; then
283 if test -n "$fail"; then
284 echo "Format string recognition error:" 1>&2
285 cat f-sc-1-
$n.
in 1>&2
287 cat f-sc-1-
$n.po
1>&2
290 rm -f f-sc-1-
$n.
in f-sc-1-
$n.po