2 . "${srcdir=.}/init.sh"; path_prepend_ . ../src
4 # Test checking of PHP format strings.
6 cat <<\EOF > f-ph-2.data
7 # Valid: %% doesn't count
10 # Invalid: invalid msgstr
13 # Valid: same arguments
16 # Valid: same arguments, with different widths
19 # Valid: same arguments but in numbered syntax
24 msgstr "xyz%3$c%2$g%1$s"
25 # Invalid: too few arguments
26 msgid "abc%2$udef%1$s"
28 # Invalid: too few arguments
31 # Invalid: too many arguments
34 # Valid: same numbered arguments, with different widths
36 msgstr "xyz%2$4s%1$5s"
37 # Invalid: missing argument
38 msgid "abc%2$sdef%1$u"
40 # Invalid: missing argument
41 msgid "abc%1$sdef%2$u"
43 # Invalid: added argument
45 msgstr "xyz%1$uvw%2$c"
46 # Valid: type compatibility
49 # Valid: type compatibility
52 # Valid: type compatibility
55 # Valid: type compatibility
58 # Valid: type compatibility
61 # Valid: type compatibility
64 # Invalid: type incompatibility
67 # Invalid: type incompatibility
70 # Invalid: type incompatibility
73 # Invalid: type incompatibility
76 # Invalid: type incompatibility
79 # Invalid: type incompatibility
86 while read comment; do
90 cat <<EOF > f-ph-2-$n.po
96 if echo "$comment" | grep 'Valid:' > /dev/null; then
97 if ${MSGFMT} --check-format -o f-ph-2-$n.mo f-ph-2-$n.po; then
103 ${MSGFMT} --check-format -o f-ph-2-$n.mo f-ph-2-$n.po 2> /dev/null
110 if test -n "$fail"; then
111 echo "Format string checking error:" 1>&2
112 cat f-ph-2-$n.po 1>&2
115 rm -f f-ph-2-$n.po f-ph-2-$n.mo