No empty .Rs/.Re
[netbsd-mini2440.git] / gnu / dist / gettext / gettext-tools / tests / format-scheme-2
blob0be970f271ce6aeed369997232ac00fda4146b04
1 #! /bin/sh
3 # Test checking of Lisp format strings.
5 tmpfiles=""
6 trap 'rm -fr $tmpfiles' 1 2 3 15
8 tmpfiles="$tmpfiles f-sc-2.data"
9 cat <<\EOF > f-sc-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: ~! doesn't count
17 msgid "abc~!def"
18 msgstr "xyz"
19 # Valid: ~Q doesn't count
20 msgid "abc~Qdef"
21 msgstr "xyz"
22 # Valid: same argument
23 msgid "abc~Ddef"
24 msgstr "xyz~D"
25 # Valid: same arguments
26 msgid "abc~1000000@*~Ddef"
27 msgstr "~1000000@*xyz~D"
28 # Valid: permutation
29 msgid "abc~D~C~Fdef"
30 msgstr "xyz~2@*~F~2:*~C~2:*~D"
31 # Invalid: too few arguments
32 msgid "abc~1@*~Sdef~0@*~S"
33 msgstr "xyz~S"
34 # Invalid: too many arguments
35 msgid "abc~Ddef"
36 msgstr "xyz~Duvw~C"
37 # Invalid: missing non-final argument
38 msgid "abc~1@*~Sdef~0@*~F"
39 msgstr "xyz~1@*~S"
40 # Invalid: added non-final argument
41 msgid "abc~1@*~Ddef"
42 msgstr "xyz~F~D"
43 # Valid: formatting variations
44 msgid "abc~Sdef"
45 msgstr "xyz~:S"
46 # Valid: formatting variations
47 msgid "abc~4Sdef"
48 msgstr "xyz~7S"
49 # Valid: type compatibility
50 msgid "abc~Sdef"
51 msgstr "xyz~Y"
52 # Valid: type compatibility
53 msgid "abc~Ddef"
54 msgstr "xyz~B"
55 # Valid: type compatibility
56 msgid "abc~Ddef"
57 msgstr "xyz~O"
58 # Valid: type compatibility
59 msgid "abc~Ddef"
60 msgstr "xyz~X"
61 # Valid: type compatibility
62 msgid "abc~Ddef"
63 msgstr "xyz~R"
64 # Valid: optional plural
65 msgid "~D egg~:P"
66 msgstr "~D Eier"
67 # Valid: type compatibility
68 msgid "abc~Fdef"
69 msgstr "xyz~E"
70 # Valid: type compatibility
71 msgid "abc~Fdef"
72 msgstr "xyz~G"
73 # Valid: type compatibility
74 msgid "abc~Fdef"
75 msgstr "xyz~$"
76 # Invalid: type incompatibility
77 msgid "abc~Fdef"
78 msgstr "xyz~D"
79 # Invalid: type incompatibility
80 msgid "abc~Ddef"
81 msgstr "xyz~C"
82 # Invalid: type incompatibility
83 msgid "abc~Fdef"
84 msgstr "xyz~C"
85 # Invalid: type incompatibility
86 msgid "abc~Sdef"
87 msgstr "xyz~D"
88 # Invalid: type incompatibility
89 msgid "abc~Sdef"
90 msgstr "xyz~F"
91 # Invalid: type incompatibility
92 msgid "abc~Sdef"
93 msgstr "xyz~C"
94 # Invalid: type incompatibility
95 msgid "abc~Fdef"
96 msgstr "xyz~I"
97 # Invalid: type incompatibility
98 msgid "abc~Ddef"
99 msgstr "xyz~I"
100 # Invalid: type incompatibility
101 msgid "abc~Sdef"
102 msgstr "xyz~I"
103 # Invalid: type incompatibility
104 msgid "abc~Cdef"
105 msgstr "xyz~I"
106 # Valid: extra formatting
107 msgid "abc~Ddef~S"
108 msgstr "xyz~D~_d~/ef~%~S"
109 # Valid: extra force-output
110 msgid "abc~Ddef~S"
111 msgstr "xyz~Ddef~S~!"
112 # Valid: FORMAT-GOTO doesn't consume an argument by itself
113 msgid "abc~5@*~Ddef~C"
114 msgstr "xyz~6@*~C~2@*uvw~5@*~R"
115 # Valid: ~? and ~K are equivalent
116 msgid "abc~?"
117 msgstr "xyz~K"
118 # Invalid: @ matters
119 msgid "abc~?"
120 msgstr "xyz~@?"
121 # Valid: case conversion is optional
122 msgid "abc~(~S~)"
123 msgstr "xyz~S"
124 # Valid: case conversion is optional
125 msgid "abc~(~D~^ ~D~)"
126 msgstr "xyz~D~^ ~D"
127 # Invalid: ~^ matters
128 msgid "abc~(~D~^ ~D~)"
129 msgstr "xyz~(~D ~D~)"
130 # Valid: case conversion is optional, and it doesn't catch ~^
131 msgid "abc~(~D~^ ~D~)def~C"
132 msgstr "xyz~D~^ ~Duvw~C"
133 # Valid: synonymous conditionals
134 msgid "abc~@[~D~]def~C"
135 msgstr "xyz~:[~;~:*~D~]~C"
136 # Valid: synonymous conditionals
137 msgid "abc~Ddef"
138 msgstr "abc~[null~;eins~:;~:*~D~]def"
139 # Valid: conditionals are optional and don't catch ~^
140 msgid "abc~:[~;~]~^~D~C"
141 msgstr "xyz~:[uvw~^~R~;~:*~S~^~D~]~C"
142 # Invalid: ~:[ requires an argument, ~1@* doesn't
143 msgid "abc~1@*~^~D~C"
144 msgstr "xyz~:[uvw~^~R~;~:*~S~^~D~]~C"
145 # Invalid: ~{~} is special
146 msgid "abc~{ ~}"
147 msgstr "xyz~{~}"
148 # Invalid: @ matters
149 msgid "abc~{~S~}"
150 msgstr "xyz~@{~S~}"
151 # Invalid: @ matters
152 msgid "abc~:{~S~}"
153 msgstr "xyz~@:{~S~}"
154 # Invalid: : matters
155 msgid "abc~{~S~}"
156 msgstr "xyz~:{~S~}"
157 # Invalid: : matters
158 msgid "abc~@{~S~}"
159 msgstr "xyz~@:{~S~}"
160 # Invalid: @: matters
161 msgid "abc~{~S~}"
162 msgstr "xyz~@:{~S~}"
163 # Valid: permutation inside iteration
164 msgid "abc~{~D ~C~}"
165 msgstr "xyz~{~1@*~C~2:*~D~1*~}"
166 # Invalid: permutation inside iteration, but wrong position at iteration end
167 msgid "abc~{~D ~C~}"
168 msgstr "xyz~{~1@*~C~2:*~D~}"
169 # Invalid: ~^ inside iteration matters
170 msgid "abc~{~D ~^~C~}"
171 msgstr "xyz~{~D ~C~}"
172 # Invalid: ~^ inside iteration depends on position
173 msgid "abc~{~D ~^~C~}"
174 msgstr "xyz~{~1@*~C~^~2:*~D~1*~}"
175 # Invalid: ~^ inside iteration depends on position
176 msgid "abc~{~D ~^~C~}"
177 msgstr "xyz~{~1@*~C~2:*~^~D~1*~}"
178 # Invalid: ~^ inside iteration depends on position
179 msgid "abc~{~D ~^~C~}"
180 msgstr "xyz~{~1@*~C~2:*~D~^~1*~}"
181 # Invalid: ~^ inside iteration depends on position
182 msgid "abc~{~D ~^~C~}"
183 msgstr "xyz~{~1@*~C~2:*~D~1*~^~}"
186 : ${MSGFMT=msgfmt}
188 while read comment; do
189 read msgid_line
190 read msgstr_line
191 n=`expr $n + 1`
192 tmpfiles="$tmpfiles f-sc-2-$n.po f-sc-2-$n.mo"
193 cat <<EOF > f-sc-2-$n.po
194 #, scheme-format
195 ${msgid_line}
196 ${msgstr_line}
198 fail=
199 if echo "$comment" | grep 'Valid:' > /dev/null; then
200 if ${MSGFMT} --check-format -o f-sc-2-$n.mo f-sc-2-$n.po; then
202 else
203 fail=yes
205 else
206 ${MSGFMT} --check-format -o f-sc-2-$n.mo f-sc-2-$n.po 2> /dev/null
207 if test $? = 1; then
209 else
210 fail=yes
213 if test -n "$fail"; then
214 echo "Format string checking error:" 1>&2
215 cat f-sc-2-$n.po 1>&2
216 exit 1
218 rm -f f-sc-2-$n.po f-sc-2-$n.mo
219 done < f-sc-2.data
221 rm -fr $tmpfiles
223 exit 0