3 # Test checking of Perl format strings.
6 trap 'rm -fr $tmpfiles' 1 2 3 15
8 tmpfiles
="$tmpfiles f-pl-2.data"
9 cat <<\EOF
> f-pl-2.data
10 # Valid: %% doesn't count
13 # Invalid: invalid msgstr
16 # Valid: same arguments
19 # Valid: same arguments, with different widths
22 # Valid: same arguments but in numbered syntax
27 msgstr
"xyz%3$c%2$g%1$s"
28 # Invalid: too few arguments
29 msgid
"abc%2$udef%1$s"
31 # Invalid: too few arguments
34 # Invalid: too many arguments
37 # Valid: same numbered arguments, with different widths
39 msgstr
"xyz%2$4s%1$5s"
40 # Invalid: missing argument
41 msgid
"abc%2$sdef%1$u"
43 # Invalid: missing argument
44 msgid
"abc%1$sdef%2$u"
46 # Invalid: added argument
48 msgstr
"xyz%1$uvw%2$c"
49 # Valid: type compatibility
52 # Valid: type compatibility
55 # Valid: type compatibility
58 # Valid: type compatibility
61 # Valid: type compatibility
64 # Valid: type and size compatibility
67 # Valid: type compatibility
70 # Valid: type compatibility
73 # Valid: type compatibility
76 # Valid: type compatibility
79 # Valid: type compatibility
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 # Invalid: type incompatibility
109 # Invalid: type incompatibility
112 # Invalid: type incompatibility
115 # Invalid: type incompatibility
118 # Invalid: type incompatibility
121 # Invalid: type incompatibility
124 # Invalid: type incompatibility
127 # Invalid: type incompatibility
130 # Invalid: type incompatibility
133 # Invalid: type incompatibility
136 # Invalid: type incompatibility
139 # Invalid: type incompatibility
142 # Invalid: type incompatibility
145 # Invalid: type incompatibility
148 # Invalid: type incompatibility
151 # Invalid: type incompatibility
154 # Invalid: type incompatibility
157 # Invalid: type incompatibility
160 # Invalid: type incompatibility
163 # Invalid: type incompatibility
166 # Invalid: size incompatibility
169 # Invalid: size incompatibility
172 # Invalid: size incompatibility
175 # Invalid: size incompatibility
178 # Invalid: size incompatibility
181 # Invalid: size incompatibility
184 # Invalid: size incompatibility
187 # Invalid: size incompatibility
190 # Invalid: size incompatibility
193 # Invalid: size incompatibility
196 # Invalid: size incompatibility
199 # Invalid: size incompatibility
202 # Invalid: size incompatibility
205 # Invalid: type incompatibility for width
212 while read comment
; do
216 tmpfiles
="$tmpfiles f-pl-2-$n.po f-pl-2-$n.mo"
217 cat <<EOF > f-pl-2-$n.po
223 if echo "$comment" |
grep 'Valid:' > /dev
/null
; then
224 if ${MSGFMT} --check-format -o f-pl-2-
$n.mo f-pl-2-
$n.po
; then
230 ${MSGFMT} --check-format -o f-pl-2-
$n.mo f-pl-2-
$n.po
2> /dev
/null
237 if test -n "$fail"; then
238 echo "Format string checking error:" 1>&2
239 cat f-pl-2-
$n.po
1>&2
242 rm -f f-pl-2-
$n.po f-pl-2-
$n.mo