No empty .Rs/.Re
[netbsd-mini2440.git] / gnu / dist / gettext / gettext-tools / tests / format-lisp-1
blobd23256c9f53baf8eb9e7bb1f37722d190d616318
1 #! /bin/sh
3 # Test recognition of Lisp format strings.
5 tmpfiles=""
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, ( | . *)
11 "abc~~def"
12 # Valid: one argument, (* | . *)
13 "abc~Sdef"
14 # Valid: 11 arguments, (* * * * * * * * * * * | . *)
15 "abc~10@*~Sdef"
16 # Invalid: unterminated
17 "abc~~def~"
18 # Invalid: unterminated
19 "abc~~def~1"
20 # Invalid: unterminated
21 "abc~~def~:"
22 # Invalid: unterminated
23 "abc~~def~@"
24 # Valid: colon
25 "abc~:Sdef"
26 # Valid: atsign
27 "abc~@Sdef"
28 # Valid: colon and atsign
29 "abc~:@Sdef"
30 # Valid: atsign and colon
31 "abc~@:Sdef"
32 # Valid: params before atsign and colon
33 "abc~3,-4,,'*@:Sdef"
34 # Invalid: params after atsign and colon
35 "abc~@:3,-4Sdef"
36 # Invalid: params after atsign and colon
37 "abc~@:-4Sdef"
38 # Invalid: params after atsign and colon
39 "abc~@:,-4Sdef"
40 # Valid: V and # params, (i() * | . *)
41 "abc~#,vSdef"
42 # Invalid: wrong type params
43 "abc~,'*Sdef"
44 # Valid: FORMAT-ASCII, (i() i() i() c() * | . *)
45 "abc~v,v,v,vA"
46 # Invalid: too many params
47 "abc~v,v,v,v,5A"
48 # Valid: FORMAT-S-EXPRESSION, (i() i() i() c() * | . *)
49 "abc~v,v,v,vS"
50 # Invalid: too many params
51 "abc~v,v,v,v,5S"
52 # Valid: FORMAT-WRITE, (* | . *)
53 "abc~W"
54 # Invalid: too many params
55 "abc~3W"
56 # Valid: FORMAT-DECIMAL, (i() c() c() i() i | . *)
57 "abc~v,v,v,vD"
58 # Invalid: too many params
59 "abc~v,v,v,v,5D"
60 # Valid: FORMAT-BINARY, (i() c() c() i() i | . *)
61 "abc~v,v,v,vB"
62 # Invalid: too many params
63 "abc~v,v,v,v,5B"
64 # Valid: FORMAT-OCTAL, (i() c() c() i() i | . *)
65 "abc~v,v,v,vO"
66 # Invalid: too many params
67 "abc~v,v,v,v,5O"
68 # Valid: FORMAT-HEXADECIMAL, (i() c() c() i() i | . *)
69 "abc~v,v,v,vX"
70 # Invalid: too many params
71 "abc~v,v,v,v,5X"
72 # Valid: FORMAT-RADIX, (i() i() c() c() i() i | . *)
73 "abc~v,v,v,v,vR"
74 # Invalid: too many params
75 "abc~v,v,v,v,v,5R"
76 # Valid: FORMAT-PLURAL, (* | . *)
77 "abc~P"
78 # Valid: FORMAT-PLURAL, (i | . *)
79 "abc~R egg~:P"
80 # Invalid: too many params
81 "abc~2P"
82 # Valid: FORMAT-CHARACTER, (c | . *)
83 "abc~C"
84 # Invalid: too many params
85 "abc~4C"
86 # Valid: FORMAT-FIXED-FLOAT, (i() i() i() c() c() r | . *)
87 "abc~v,v,v,v,vF"
88 # Invalid: too many params
89 "abc~v,v,v,v,v,5F"
90 # Valid: FORMAT-EXPONENTIAL-FLOAT, (i() i() i() i() c() c() c() r | . *)
91 "abc~v,v,v,v,v,v,vE"
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 | . *)
95 "abc~v,v,v,v,v,v,vG"
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 | . *)
99 "abc~v,v,v,v$"
100 # Invalid: too many params
101 "abc~v,v,v,v,5$"
102 # Valid: FORMAT-TERPRI, (i() | . *)
103 "abc~v%"
104 # Invalid: too many params
105 "abc~v,5%"
106 # Valid: FORMAT-FRESH-LINE, (i() | . *)
107 "abc~v&"
108 # Invalid: too many params
109 "abc~v,5&"
110 # Valid: FORMAT-PAGE, (i() | . *)
111 "abc~v|"
112 # Invalid: too many params
113 "abc~v,5|"
114 # Valid: FORMAT-TILDE, (i() | . *)
115 "abc~v~"
116 # Invalid: too many params
117 "abc~v,5~"
118 # Valid: underscore, ( | . *)
119 "abc~_"
120 # Invalid: too many params
121 "abc~5_"
122 # Valid: FORMAT-TABULATE, (i() i() | . *)
123 "abc~v,vT"
124 # Invalid: too many params
125 "abc~v,v,5T"
126 # Valid: FORMAT-GOTO absolute, (* r c | . *)
127 "abc~S~F~S~2@*~C"
128 # Invalid: type incompatibility
129 "abc~S~F~S~1@*~C"
130 # Valid: FORMAT-GOTO backward, (* c r | . *)
131 "abc~S~S~F~2:*~C"
132 # Invalid: type incompatibility
133 "abc~S~S~F~1:*~C"
134 # Invalid: too many params
135 "abc~v,4*"
136 # Valid: FORMAT-GOTO with large number
137 "abc~S~F~S~1000000@*~C"
138 # Valid: FORMAT-INDIRECTION, (~ ( | . *) | . *)
139 "abc~?"
140 # Valid: FORMAT-INDIRECTION, (~ | . *)
141 "abc~@?"
142 # Invalid: too many params
143 "abc~4?"
144 # Valid: FORMAT-CALL-USER-FUNCTION, (* | . *)
145 "abc~/FOOBAR/"
146 # Invalid: too many params
147 "abc~4/FOOBAR/"
148 # Invalid: unterminated
149 "abc~/FOOB"
150 # Invalid: nesting mismatch
151 "abc~(~/FOOB~)/"
152 # Valid: FORMAT-CASE-CONVERSION, (* | . *)
153 "abc~(~S~)"
154 # Invalid: too many params
155 "abc~4(~S~)"
156 # Invalid: too many params
157 "abc~(~S~4)"
158 # Invalid: unterminated
159 "abc~(~S"
160 # Invalid: separator
161 "abc~(~S~;~S~)"
162 # Valid: FORMAT-CONDITIONAL, (i() c | . *)
163 "abc~@[~D~]~C"
164 # Valid: FORMAT-CONDITIONAL, (i() | . *)
165 "abc~@[~D~D~]~C"
166 # Invalid: separator
167 "abc~@[~D~;~D~]~C"
168 # Valid: FORMAT-CONDITIONAL, (* i c | . *)
169 "abc~:[~X~;~D~]~C"
170 # Invalid: missing separator
171 "abc~:[~D~]~C"
172 # Invalid: too many separators
173 "abc~:[~X~;~D~;~E~]~C"
174 # Valid: FORMAT-CONDITIONAL, (* | . *)
175 "abc~[~D~;~X~]~C"
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
181 "abc~4@[~D~]"
182 # Invalid: too many params
183 "abc~@[~D~4]"
184 # Invalid: too many params
185 "abc~4:[~D~;~X~]"
186 # Invalid: too many params
187 "abc~:[~D~4;~X~]"
188 # Invalid: too many params
189 "abc~:[~D~;~X~4]"
190 # Valid: FORMAT-CONDITIONAL, one param, without colon or atsign
191 "abc~4[~D~;~X~]"
192 # Invalid: too many params
193 "abc~4,4[~D~;~X~]"
194 # Invalid: too many params
195 "abc~[~D~4;~X~]"
196 # Invalid: too many params
197 "abc~[~D~;~X~4]"
198 # Valid: FORMAT-ITERATION, (( | . *) | . *)
199 "abc~{~~~}"
200 # Valid: FORMAT-ITERATION, (( | . ( | . *)) | . *)
201 "abc~:{~~~}"
202 # Valid: FORMAT-ITERATION, ( | . *)
203 "abc~@{~~~}"
204 # Valid: FORMAT-ITERATION, ( | . ( | . *))
205 "abc~:@{~~~}"
206 # Valid: FORMAT-ITERATION with indirection, (~ ( | . *) | . *)
207 "abc~{~}"
208 # Valid: FORMAT-ITERATION with indirection, (~ ( | . ( | . *)) | . *)
209 "abc~:{~}"
210 # Valid: FORMAT-ITERATION with indirection, (~ | . *)
211 "abc~@{~}"
212 # Valid: FORMAT-ITERATION with indirection, (~ | . ( | . *))
213 "abc~:@{~}"
214 # Valid: FORMAT-ITERATION with loop, (( | . i c) | . *)
215 "abc~{~D ~C~}"
216 # Valid: FORMAT-ITERATION with loop, (( | . (i c | . *)) | . *)
217 "abc~:{~D ~C~}"
218 # Valid: FORMAT-ITERATION with loop, ( | . i c)
219 "abc~@{~D ~C~}"
220 # Valid: FORMAT-ITERATION with loop, ( | . (i c | . *))
221 "abc~:@{~D ~C~}"
222 # Valid: FORMAT-ITERATION with variable-advance loop, (( | . *) | . *)
223 "abc~{~[~D~]~}"
224 # Valid: FORMAT-ITERATION with variable-advance loop, (( | . (* | . *)) | . *)
225 "abc~:{~[~D~]~}"
226 # Valid: FORMAT-ITERATION with variable-advance loop, ( | . *)
227 "abc~@{~[~D~]~}"
228 # Valid: FORMAT-ITERATION with variable-advance loop, ( | . (* | . *))
229 "abc~:@{~[~D~]~}"
230 # Invalid: separator
231 "abc~{~D~;~C~}"
232 # Valid: FORMAT-JUSTIFICATION, (i() i() i() c() i | . *)
233 "abc~v,v,v,v<~D~>"
234 # Invalid: too many params
235 "abc~v,v,v,v,4<~D~>"
236 # Valid: separators
237 "abc~<~D~;~X~;def~>"
238 # Invalid: wrongly nested
239 "abc~<~(~>~)"
240 # Invalid: wrongly nested
241 "abc~{~(~}~)"
242 # Invalid: wrongly nested
243 "abc~{~<~}~>"
244 # Valid: FORMAT-CALL, (f * | . *)
245 "abc~!"
246 # Valid: any number of arguments
247 "abc~v,v,v,v,v!"
248 # Invalid: type incompatibility between integer and list
249 "abc~D~:*~{~D~}"
250 # Invalid: type incompatibility between real and list
251 "abc~{~S~}~:*~F"
252 # Valid: list must be empty
253 "abc~{~C~}~:*~{~D~}"
256 : ${XGETTEXT=xgettext}
258 while read comment; do
259 read string
260 n=`expr $n + 1`
261 tmpfiles="$tmpfiles f-l-1-$n.in f-l-1-$n.po"
262 cat <<EOF > f-l-1-$n.in
263 (gettext ${string})
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
267 fail=
268 if echo "$comment" | grep 'Valid:' > /dev/null; then
269 if grep lisp-format f-l-1-$n.po > /dev/null; then
271 else
272 fail=yes
274 else
275 if grep lisp-format f-l-1-$n.po > /dev/null; then
276 fail=yes
277 else
281 if test -n "$fail"; then
282 echo "Format string recognition error:" 1>&2
283 cat f-l-1-$n.in 1>&2
284 echo "Got:" 1>&2
285 cat f-l-1-$n.po 1>&2
286 exit 1
288 rm -f f-l-1-$n.in f-l-1-$n.po
289 done < f-l-1.data
291 rm -fr $tmpfiles
293 exit 0