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