3 # Test checking of Lisp format strings.
6 trap 'rm -fr $tmpfiles' 1 2 3 15
8 tmpfiles
="$tmpfiles f-l-2.data"
9 cat <<\EOF
> f-l-2.data
10 # Valid: ~~ doesn't count
13 # Invalid: invalid msgstr
16 # Valid: same argument
19 # Valid: same arguments
20 msgid
"abc~1000000@*~Ddef"
21 msgstr
"~1000000@*xyz~D"
24 msgstr
"xyz~2@*~F~2:*~C~2:*~D"
25 # Invalid: too few arguments
26 msgid
"abc~1@*~Sdef~0@*~S"
28 # Invalid: too many arguments
31 # Invalid: missing non-final argument
32 msgid
"abc~1@*~Sdef~0@*~F"
34 # Invalid: added non-final argument
37 # Valid: formatting variations
40 # Valid: formatting variations
43 # Valid: type compatibility
46 # Valid: type compatibility
49 # Valid: type compatibility
52 # Valid: type compatibility
55 # Valid: type compatibility
58 # Valid: optional plural
61 # Valid: type compatibility
64 # Valid: type compatibility
67 # Valid: type compatibility
70 # Invalid: type incompatibility
73 # Invalid: type incompatibility
76 # Invalid: type incompatibility
79 # Invalid: type incompatibility
82 # Invalid: type incompatibility
85 # Invalid: type incompatibility
88 # Valid: extra formatting
90 msgstr
"xyz~D~_def~%~S"
91 # Valid: FORMAT-GOTO doesn't consume an argument by itself
92 msgid
"abc~5@*~Ddef~C"
93 msgstr
"xyz~6@*~C~2@*uvw~5@*~R"
97 # Valid: case conversion is optional
100 # Valid: case conversion is optional
101 msgid
"abc~(~D~^ ~D~)"
103 # Invalid: ~^ matters
104 msgid
"abc~(~D~^ ~D~)"
105 msgstr
"xyz~(~D ~D~)"
106 # Valid: case conversion is optional, and it doesn't catch ~^
107 msgid
"abc~(~D~^ ~D~)def~C"
108 msgstr
"xyz~D~^ ~Duvw~C"
109 # Valid: synonymous conditionals
110 msgid
"abc~@[~D~]def~C"
111 msgstr
"xyz~:[~;~:*~D~]~C"
112 # Valid: synonymous conditionals
114 msgstr
"abc~[null~;eins~:;~:*~D~]def"
115 # Valid: conditionals are optional and don't catch ~^
116 msgid
"abc~:[~;~]~^~D~C"
117 msgstr
"xyz~:[uvw~^~R~;~:*~S~^~D~]~C"
118 # Invalid: ~:[ requires an argument, ~1@* doesn't
119 msgid
"abc~1@*~^~D~C"
120 msgstr
"xyz~:[uvw~^~R~;~:*~S~^~D~]~C"
121 # Invalid: ~{~} is special
136 # Invalid: @: matters
139 # Valid: permutation inside iteration
141 msgstr
"xyz~{~1@*~C~2:*~D~1*~}"
142 # Invalid: permutation inside iteration, but wrong position at iteration end
144 msgstr
"xyz~{~1@*~C~2:*~D~}"
145 # Invalid: ~^ inside iteration matters
146 msgid
"abc~{~D ~^~C~}"
147 msgstr
"xyz~{~D ~C~}"
148 # Invalid: ~^ inside iteration depends on position
149 msgid
"abc~{~D ~^~C~}"
150 msgstr
"xyz~{~1@*~C~^~2:*~D~1*~}"
151 # Invalid: ~^ inside iteration depends on position
152 msgid
"abc~{~D ~^~C~}"
153 msgstr
"xyz~{~1@*~C~2:*~^~D~1*~}"
154 # Invalid: ~^ inside iteration depends on position
155 msgid
"abc~{~D ~^~C~}"
156 msgstr
"xyz~{~1@*~C~2:*~D~^~1*~}"
157 # Invalid: ~^ inside iteration depends on position
158 msgid
"abc~{~D ~^~C~}"
159 msgstr
"xyz~{~1@*~C~2:*~D~1*~^~}"
160 # Valid: justification is optional
161 msgid
"abc~<~D~;~C~>"
163 # Valid: justification with different segmentation
164 msgid
"abc~<~D ~D~;~C~;~S~S~>"
165 msgstr
"xyz~<~D~;~D~C~S~;~S~>"
166 # Invalid: justification catches ~^
167 msgid
"abc~<~D~;~^~D~>~C"
173 while read comment
; do
177 tmpfiles
="$tmpfiles f-l-2-$n.po f-l-2-$n.mo"
178 cat <<EOF > f-l-2-$n.po
184 if echo "$comment" |
grep 'Valid:' > /dev
/null
; then
185 if ${MSGFMT} --check-format -o f-l-2-
$n.mo f-l-2-
$n.po
; then
191 ${MSGFMT} --check-format -o f-l-2-
$n.mo f-l-2-
$n.po
2> /dev
/null
198 if test -n "$fail"; then
199 echo "Format string checking error:" 1>&2
203 rm -f f-l-2-
$n.po f-l-2-
$n.mo