3 # Test checking of GFC internal format strings.
6 trap 'rm -fr $tmpfiles' 1 2 3 15
8 tmpfiles="$tmpfiles f-gf-2.data"
9 cat <<\EOF > f-gf-2.data
10 # Valid: %% doesn't count
13 # Invalid: %C consumes currentloc
16 # Invalid: %C consumes currentloc
19 # Invalid: invalid msgstr
22 # Valid: same arguments
25 # Valid: same arguments but in numbered syntax
30 msgstr "xyz%3$c%2$d%1$s"
31 # Invalid: too few arguments
34 # Invalid: too many arguments
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 # Invalid: type incompatibility
52 # Invalid: type incompatibility
55 # Invalid: type incompatibility
58 # Invalid: type incompatibility
61 # Invalid: type incompatibility
64 # Invalid: type incompatibility
67 # Invalid: type incompatibility
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 # 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: permutation
136 # Valid: currentloc reference position does not matter
139 # Valid: currentloc reference may be repeated
141 msgstr "abc%sdef%Cghi%C"
142 # Valid: currentloc reference may be repeated and permuted
143 msgid "abc%Cdef%Cghi%s"
149 while read comment; do
153 tmpfiles="$tmpfiles f-gf-2-$n.po f-gf-2-$n.mo"
154 cat <<EOF > f-gf-2-$n.po
155 #, gfc-internal-format
160 if echo "$comment" | grep 'Valid:' > /dev/null; then
161 if ${MSGFMT} --check-format -o f-gf-2-$n.mo f-gf-2-$n.po; then
167 ${MSGFMT} --check-format -o f-gf-2-$n.mo f-gf-2-$n.po 2> /dev/null
174 if test -n "$fail"; then
175 echo "Format string checking error:" 1>&2
176 cat f-gf-2-$n.po 1>&2
179 rm -f f-gf-2-$n.po f-gf-2-$n.mo