3 # Test checking of Boost format strings.
6 trap 'rm -fr $tmpfiles' 1 2 3 15
8 tmpfiles="$tmpfiles f-bo-2.data"
9 cat <<\EOF > f-bo-2.data
10 # Valid: %% doesn't count
13 # Invalid: invalid msgstr
16 # Valid: same arguments
19 # Valid: same arguments, despite different syntax
22 # Valid: same arguments, with different widths
25 # Valid: same arguments but in numbered syntax
28 # Valid: same arguments but in numbered syntax
33 msgstr "xyz%3$c%2$g%1$s"
34 # Invalid: too few arguments
35 msgid "abc%2$udef%1$s"
37 # Invalid: too few arguments
40 # Invalid: too many arguments
43 # Valid: same numbered arguments, with different widths
45 msgstr "xyz%2$4s%1$5s"
46 # Invalid: missing argument
47 msgid "abc%2$sdef%1$u"
49 # Invalid: missing argument
50 msgid "abc%1$sdef%2$u"
52 # Invalid: added argument
54 msgstr "xyz%1$uvw%2$c"
55 # Valid: type compatibility
58 # Valid: type compatibility
61 # Valid: type compatibility
64 # Valid: type 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: different argument count
97 # Invalid: type incompatibility
100 # Invalid: type incompatibility
103 # Invalid: type incompatibility
106 # Invalid: different argument count
109 # Invalid: type incompatibility
112 # Invalid: type incompatibility
115 # Invalid: different argument count
118 # Invalid: type incompatibility
121 # Invalid: different argument count
124 # Invalid: different argument count
127 # Valid: size is ignored
130 # Valid: size is ignored
133 # Valid: size is ignored
136 # Valid: size is ignored
139 # Valid: size is ignored
142 # Valid: size is ignored
145 # Valid: size is ignored
148 # Valid: size is ignored
151 # Valid: size is ignored
154 # Valid: size is ignored
157 # Valid: size is ignored
160 # Valid: size is ignored
163 # Valid: size is ignored
166 # Valid: size is ignored
169 # Invalid: type incompatibility for width
176 while read comment; do
180 tmpfiles="$tmpfiles f-bo-2-$n.po f-bo-2-$n.mo"
181 cat <<EOF > f-bo-2-$n.po
187 if echo "$comment" | grep 'Valid:' > /dev/null; then
188 if ${MSGFMT} --check-format -o f-bo-2-$n.mo f-bo-2-$n.po; then
194 ${MSGFMT} --check-format -o f-bo-2-$n.mo f-bo-2-$n.po 2> /dev/null
201 if test -n "$fail"; then
202 echo "Format string checking error:" 1>&2
203 cat f-bo-2-$n.po 1>&2
206 rm -f f-bo-2-$n.po f-bo-2-$n.mo