No empty .Rs/.Re
[netbsd-mini2440.git] / gnu / dist / gettext / gettext-tools / tests / format-elisp-2
blobe5516e2566f14e14d13c54fa813cc37d3526e236
1 #! /bin/sh
3 # Test checking of Emacs Lisp format strings.
5 tmpfiles=""
6 trap 'rm -fr $tmpfiles' 1 2 3 15
8 tmpfiles="$tmpfiles f-el-2.data"
9 cat <<\EOF > f-el-2.data
10 # Valid: %% doesn't count
11 msgid "abc%%def"
12 msgstr "xyz"
13 # Invalid: invalid msgstr
14 msgid "abc%%def"
15 msgstr "xyz%"
16 # Valid: same arguments
17 msgid "abc%s%xdef"
18 msgstr "xyz%s%x"
19 # Valid: same arguments, with different widths
20 msgid "abc%2sdef"
21 msgstr "xyz%3s"
22 # Valid: same arguments but in numbered syntax
23 msgid "abc%s%xdef"
24 msgstr "xyz%1$s%2$x"
25 # Valid: permutation
26 msgid "abc%s%x%cdef"
27 msgstr "xyz%3$c%2$x%1$s"
28 # Invalid: too few arguments
29 msgid "abc%2$xdef%1$s"
30 msgstr "xyz%1$s"
31 # Invalid: too few arguments
32 msgid "abc%sdef%x"
33 msgstr "xyz%s"
34 # Invalid: too many arguments
35 msgid "abc%xdef"
36 msgstr "xyz%xvw%c"
37 # Valid: same numbered arguments, with different widths
38 msgid "abc%2$5s%1$4s"
39 msgstr "xyz%2$4s%1$5s"
40 # Invalid: missing argument
41 msgid "abc%2$sdef%1$x"
42 msgstr "xyz%1$x"
43 # Invalid: missing argument
44 msgid "abc%1$sdef%2$x"
45 msgstr "xyz%2$x"
46 # Invalid: added argument
47 msgid "abc%1$xdef"
48 msgstr "xyz%1$xvw%2$c"
49 # Valid: type compatibility
50 msgid "abc%d"
51 msgstr "xyz%i"
52 # Valid: type compatibility
53 msgid "abc%d"
54 msgstr "xyz%x"
55 # Valid: type compatibility
56 msgid "abc%d"
57 msgstr "xyz%X"
58 # Valid: type compatibility
59 msgid "abc%d"
60 msgstr "xyz%o"
61 # Valid: type compatibility
62 msgid "abc%x"
63 msgstr "xyz%X"
64 # Valid: type compatibility
65 msgid "abc%x"
66 msgstr "xyz%o"
67 # Valid: type compatibility
68 msgid "abc%X"
69 msgstr "xyz%o"
70 # Valid: type compatibility
71 msgid "abc%e"
72 msgstr "xyz%E"
73 # Valid: type compatibility
74 msgid "abc%e"
75 msgstr "xyz%f"
76 # Valid: type compatibility
77 msgid "abc%e"
78 msgstr "xyz%g"
79 # Valid: type compatibility
80 msgid "abc%e"
81 msgstr "xyz%G"
82 # Invalid: type incompatibility
83 msgid "abc%c"
84 msgstr "xyz%d"
85 # Invalid: type incompatibility
86 msgid "abc%c"
87 msgstr "xyz%i"
88 # Invalid: type incompatibility
89 msgid "abc%c"
90 msgstr "xyz%x"
91 # Invalid: type incompatibility
92 msgid "abc%c"
93 msgstr "xyz%X"
94 # Invalid: type incompatibility
95 msgid "abc%c"
96 msgstr "xyz%o"
97 # Invalid: type incompatibility
98 msgid "abc%c"
99 msgstr "xyz%e"
100 # Invalid: type incompatibility
101 msgid "abc%c"
102 msgstr "xyz%E"
103 # Invalid: type incompatibility
104 msgid "abc%c"
105 msgstr "xyz%f"
106 # Invalid: type incompatibility
107 msgid "abc%c"
108 msgstr "xyz%g"
109 # Invalid: type incompatibility
110 msgid "abc%c"
111 msgstr "xyz%G"
112 # Invalid: type incompatibility
113 msgid "abc%c"
114 msgstr "xyz%s"
115 # Invalid: type incompatibility
116 msgid "abc%c"
117 msgstr "xyz%S"
118 # Invalid: type incompatibility
119 msgid "abc%d"
120 msgstr "xyz%e"
121 # Invalid: type incompatibility
122 msgid "abc%d"
123 msgstr "xyz%E"
124 # Invalid: type incompatibility
125 msgid "abc%d"
126 msgstr "xyz%f"
127 # Invalid: type incompatibility
128 msgid "abc%d"
129 msgstr "xyz%g"
130 # Invalid: type incompatibility
131 msgid "abc%d"
132 msgstr "xyz%G"
133 # Invalid: type incompatibility
134 msgid "abc%d"
135 msgstr "xyz%s"
136 # Invalid: type incompatibility
137 msgid "abc%d"
138 msgstr "xyz%S"
139 # Invalid: type incompatibility
140 msgid "abc%i"
141 msgstr "xyz%e"
142 # Invalid: type incompatibility
143 msgid "abc%i"
144 msgstr "xyz%E"
145 # Invalid: type incompatibility
146 msgid "abc%i"
147 msgstr "xyz%f"
148 # Invalid: type incompatibility
149 msgid "abc%i"
150 msgstr "xyz%g"
151 # Invalid: type incompatibility
152 msgid "abc%i"
153 msgstr "xyz%G"
154 # Invalid: type incompatibility
155 msgid "abc%i"
156 msgstr "xyz%s"
157 # Invalid: type incompatibility
158 msgid "abc%i"
159 msgstr "xyz%S"
160 # Invalid: type incompatibility
161 msgid "abc%x"
162 msgstr "xyz%e"
163 # Invalid: type incompatibility
164 msgid "abc%x"
165 msgstr "xyz%E"
166 # Invalid: type incompatibility
167 msgid "abc%x"
168 msgstr "xyz%f"
169 # Invalid: type incompatibility
170 msgid "abc%x"
171 msgstr "xyz%g"
172 # Invalid: type incompatibility
173 msgid "abc%x"
174 msgstr "xyz%G"
175 # Invalid: type incompatibility
176 msgid "abc%x"
177 msgstr "xyz%s"
178 # Invalid: type incompatibility
179 msgid "abc%x"
180 msgstr "xyz%S"
181 # Invalid: type incompatibility
182 msgid "abc%X"
183 msgstr "xyz%e"
184 # Invalid: type incompatibility
185 msgid "abc%X"
186 msgstr "xyz%E"
187 # Invalid: type incompatibility
188 msgid "abc%X"
189 msgstr "xyz%f"
190 # Invalid: type incompatibility
191 msgid "abc%X"
192 msgstr "xyz%g"
193 # Invalid: type incompatibility
194 msgid "abc%X"
195 msgstr "xyz%G"
196 # Invalid: type incompatibility
197 msgid "abc%X"
198 msgstr "xyz%s"
199 # Invalid: type incompatibility
200 msgid "abc%X"
201 msgstr "xyz%S"
202 # Invalid: type incompatibility
203 msgid "abc%o"
204 msgstr "xyz%e"
205 # Invalid: type incompatibility
206 msgid "abc%o"
207 msgstr "xyz%E"
208 # Invalid: type incompatibility
209 msgid "abc%o"
210 msgstr "xyz%f"
211 # Invalid: type incompatibility
212 msgid "abc%o"
213 msgstr "xyz%g"
214 # Invalid: type incompatibility
215 msgid "abc%o"
216 msgstr "xyz%G"
217 # Invalid: type incompatibility
218 msgid "abc%o"
219 msgstr "xyz%s"
220 # Invalid: type incompatibility
221 msgid "abc%o"
222 msgstr "xyz%S"
223 # Invalid: type incompatibility
224 msgid "abc%e"
225 msgstr "xyz%s"
226 # Invalid: type incompatibility
227 msgid "abc%e"
228 msgstr "xyz%S"
229 # Invalid: type incompatibility
230 msgid "abc%E"
231 msgstr "xyz%s"
232 # Invalid: type incompatibility
233 msgid "abc%E"
234 msgstr "xyz%S"
235 # Invalid: type incompatibility
236 msgid "abc%f"
237 msgstr "xyz%s"
238 # Invalid: type incompatibility
239 msgid "abc%f"
240 msgstr "xyz%S"
241 # Invalid: type incompatibility
242 msgid "abc%g"
243 msgstr "xyz%s"
244 # Invalid: type incompatibility
245 msgid "abc%g"
246 msgstr "xyz%S"
247 # Invalid: type incompatibility
248 msgid "abc%G"
249 msgstr "xyz%s"
250 # Invalid: type incompatibility
251 msgid "abc%G"
252 msgstr "xyz%S"
253 # Invalid: type incompatibility
254 msgid "abc%s"
255 msgstr "xyz%S"
258 : ${MSGFMT=msgfmt}
260 while read comment; do
261 read msgid_line
262 read msgstr_line
263 n=`expr $n + 1`
264 tmpfiles="$tmpfiles f-el-2-$n.po f-el-2-$n.mo"
265 cat <<EOF > f-el-2-$n.po
266 #, elisp-format
267 ${msgid_line}
268 ${msgstr_line}
270 fail=
271 if echo "$comment" | grep 'Valid:' > /dev/null; then
272 if ${MSGFMT} --check-format -o f-el-2-$n.mo f-el-2-$n.po; then
274 else
275 fail=yes
277 else
278 ${MSGFMT} --check-format -o f-el-2-$n.mo f-el-2-$n.po 2> /dev/null
279 if test $? = 1; then
281 else
282 fail=yes
285 if test -n "$fail"; then
286 echo "Format string checking error:" 1>&2
287 cat f-el-2-$n.po 1>&2
288 exit 1
290 rm -f f-el-2-$n.po f-el-2-$n.mo
291 done < f-el-2.data
293 rm -fr $tmpfiles
295 exit 0