3 # Test recognition of Lisp format strings.
6 trap 'rm -fr $tmpfiles' 1 2 3 15
8 tmpfiles
="$tmpfiles f-l-1.data"
9 cat <<\EOF
> f-l-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-WRITE, (* | . *)
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 # Invalid: too many params
86 # Valid: FORMAT-FIXED-FLOAT, (i() i() i() c() c() r | . *)
88 # Invalid: too many params
90 # Valid: FORMAT-EXPONENTIAL-FLOAT, (i() i() i() i() c() c() c() r | . *)
92 # Invalid: too many params
93 "abc~v,v,v,v,v,v,v,5E"
94 # Valid: FORMAT-GENERAL-FLOAT, (i() i() i() i() c() c() c() r | . *)
96 # Invalid: too many params
97 "abc~v,v,v,v,v,v,v,5G"
98 # Valid: FORMAT-DOLLARS-FLOAT, (i() i() i() c() r | . *)
100 # Invalid: too many params
102 # Valid: FORMAT-TERPRI, (i() | . *)
104 # Invalid: too many params
106 # Valid: FORMAT-FRESH-LINE, (i() | . *)
108 # Invalid: too many params
110 # Valid: FORMAT-PAGE, (i() | . *)
112 # Invalid: too many params
114 # Valid: FORMAT-TILDE, (i() | . *)
116 # Invalid: too many params
118 # Valid: underscore, ( | . *)
120 # Invalid: too many params
122 # Valid: FORMAT-TABULATE, (i() i() | . *)
124 # Invalid: too many params
126 # Valid: FORMAT-GOTO absolute, (* r c | . *)
128 # Invalid: type incompatibility
130 # Valid: FORMAT-GOTO backward, (* c r | . *)
132 # Invalid: type incompatibility
134 # Invalid: too many params
136 # Valid: FORMAT-GOTO with large number
137 "abc~S~F~S~1000000@*~C"
138 # Valid: FORMAT-INDIRECTION, (~ ( | . *) | . *)
140 # Valid: FORMAT-INDIRECTION, (~ | . *)
142 # Invalid: too many params
144 # Valid: FORMAT-CALL-USER-FUNCTION, (* | . *)
146 # Invalid: too many params
148 # Invalid: unterminated
150 # Invalid: nesting mismatch
152 # Valid: FORMAT-CASE-CONVERSION, (* | . *)
154 # Invalid: too many params
156 # Invalid: too many params
158 # Invalid: unterminated
162 # Valid: FORMAT-CONDITIONAL, (i() c | . *)
164 # Valid: FORMAT-CONDITIONAL, (i() | . *)
168 # Valid: FORMAT-CONDITIONAL, (* i c | . *)
170 # Invalid: missing separator
172 # Invalid: too many separators
173 "abc~:[~X~;~D~;~E~]~C"
174 # Valid: FORMAT-CONDITIONAL, (* | . *)
176 # Valid: FORMAT-CONDITIONAL, (* i c | . *)
177 "abc~[~D~;~X~:;~R~]~C"
178 # Invalid: default clause not last
179 "abc~[~D~;~X~:;~R~;~R~]~C"
180 # Invalid: too many params
182 # Invalid: too many params
184 # Invalid: too many params
186 # Invalid: too many params
188 # Invalid: too many params
190 # Valid: FORMAT-CONDITIONAL, one param, without colon or atsign
192 # Invalid: too many params
194 # Invalid: too many params
196 # Invalid: too many params
198 # Valid: FORMAT-ITERATION, (( | . *) | . *)
200 # Valid: FORMAT-ITERATION, (( | . ( | . *)) | . *)
202 # Valid: FORMAT-ITERATION, ( | . *)
204 # Valid: FORMAT-ITERATION, ( | . ( | . *))
206 # Valid: FORMAT-ITERATION with indirection, (~ ( | . *) | . *)
208 # Valid: FORMAT-ITERATION with indirection, (~ ( | . ( | . *)) | . *)
210 # Valid: FORMAT-ITERATION with indirection, (~ | . *)
212 # Valid: FORMAT-ITERATION with indirection, (~ | . ( | . *))
214 # Valid: FORMAT-ITERATION with loop, (( | . i c) | . *)
216 # Valid: FORMAT-ITERATION with loop, (( | . (i c | . *)) | . *)
218 # Valid: FORMAT-ITERATION with loop, ( | . i c)
220 # Valid: FORMAT-ITERATION with loop, ( | . (i c | . *))
222 # Valid: FORMAT-ITERATION with variable-advance loop, (( | . *) | . *)
224 # Valid: FORMAT-ITERATION with variable-advance loop, (( | . (* | . *)) | . *)
226 # Valid: FORMAT-ITERATION with variable-advance loop, ( | . *)
228 # Valid: FORMAT-ITERATION with variable-advance loop, ( | . (* | . *))
232 # Valid: FORMAT-JUSTIFICATION, (i() i() i() c() i | . *)
234 # Invalid: too many params
238 # Invalid: wrongly nested
240 # Invalid: wrongly nested
242 # Invalid: wrongly nested
244 # Valid: FORMAT-CALL, (f * | . *)
246 # Valid: any number of arguments
248 # Invalid: type incompatibility between integer and list
250 # Invalid: type incompatibility between real and list
252 # Valid: list must be empty
256 : ${XGETTEXT=xgettext}
258 while read comment
; do
261 tmpfiles
="$tmpfiles f-l-1-$n.in f-l-1-$n.po"
262 cat <<EOF > f-l-1-$n.in
265 ${XGETTEXT} -L Lisp
-o f-l-1-
$n.po f-l-1-
$n.
in ||
exit 1
266 test -f f-l-1-
$n.po ||
exit 1
268 if echo "$comment" |
grep 'Valid:' > /dev
/null
; then
269 if grep lisp-format f-l-1-
$n.po
> /dev
/null
; then
275 if grep lisp-format f-l-1-
$n.po
> /dev
/null
; then
281 if test -n "$fail"; then
282 echo "Format string recognition error:" 1>&2
288 rm -f f-l-1-
$n.
in f-l-1-
$n.po