3 # Test checking of Lisp format strings.
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
13 # Invalid: invalid msgstr
16 # Valid: ~! doesn't count
19 # Valid: ~Q doesn't count
22 # Valid: same argument
25 # Valid: same arguments
26 msgid
"abc~1000000@*~Ddef"
27 msgstr
"~1000000@*xyz~D"
30 msgstr
"xyz~2@*~F~2:*~C~2:*~D"
31 # Invalid: too few arguments
32 msgid
"abc~1@*~Sdef~0@*~S"
34 # Invalid: too many arguments
37 # Invalid: missing non-final argument
38 msgid
"abc~1@*~Sdef~0@*~F"
40 # Invalid: added non-final argument
43 # Valid: formatting variations
46 # Valid: formatting variations
49 # Valid: type compatibility
52 # Valid: type compatibility
55 # Valid: type compatibility
58 # Valid: type compatibility
61 # Valid: type compatibility
64 # Valid: optional plural
67 # Valid: type compatibility
70 # Valid: type compatibility
73 # Valid: type compatibility
76 # Invalid: type incompatibility
79 # Invalid: type incompatibility
82 # Invalid: type incompatibility
85 # Invalid: type incompatibility
88 # Invalid: type incompatibility
91 # Invalid: type incompatibility
94 # Invalid: type incompatibility
97 # Invalid: type incompatibility
100 # Invalid: type incompatibility
103 # Invalid: type incompatibility
106 # Valid: extra formatting
108 msgstr
"xyz~D~_d~/ef~%~S"
109 # Valid: extra force-output
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
121 # Valid: case conversion is optional
124 # Valid: case conversion is optional
125 msgid
"abc~(~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
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
160 # Invalid: @: matters
163 # Valid: permutation inside iteration
165 msgstr
"xyz~{~1@*~C~2:*~D~1*~}"
166 # Invalid: permutation inside iteration, but wrong position at iteration end
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*~^~}"
188 while read comment
; do
192 tmpfiles
="$tmpfiles f-sc-2-$n.po f-sc-2-$n.mo"
193 cat <<EOF > f-sc-2-$n.po
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
206 ${MSGFMT} --check-format -o f-sc-2-
$n.mo f-sc-2-
$n.po
2> /dev
/null
213 if test -n "$fail"; then
214 echo "Format string checking error:" 1>&2
215 cat f-sc-2-
$n.po
1>&2
218 rm -f f-sc-2-
$n.po f-sc-2-
$n.mo