2 . "${srcdir=.}/init.sh"; path_prepend_ . ../src
4 # Test checking of GFC internal format strings.
6 cat <<\EOF > f-gf-2.data
7 # Valid: %% doesn't count
10 # Invalid: %C consumes currentloc
13 # Invalid: %C consumes currentloc
16 # Invalid: invalid msgstr
19 # Valid: same arguments
22 # Valid: same arguments but in numbered syntax
27 msgstr "xyz%3$c%2$d%1$s"
28 # Invalid: too few arguments
31 # Invalid: too many arguments
34 # Invalid: missing argument
35 msgid "abc%2$sdef%1$u"
37 # Invalid: missing argument
38 msgid "abc%1$sdef%2$u"
40 # Invalid: added argument
42 msgstr "xyz%1$uvw%2$c"
43 # Valid: type compatibility
46 # Invalid: type incompatibility
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: permutation
133 # Valid: currentloc reference position does not matter
136 # Valid: currentloc reference may be repeated
138 msgstr "abc%sdef%Cghi%C"
139 # Valid: currentloc reference may be repeated and permuted
140 msgid "abc%Cdef%Cghi%s"
146 while read comment; do
150 cat <<EOF > f-gf-2-$n.po
151 #, gfc-internal-format
156 if echo "$comment" | grep 'Valid:' > /dev/null; then
157 if ${MSGFMT} --check-format -o f-gf-2-$n.mo f-gf-2-$n.po; then
163 ${MSGFMT} --check-format -o f-gf-2-$n.mo f-gf-2-$n.po 2> /dev/null
170 if test -n "$fail"; then
171 echo "Format string checking error:" 1>&2
172 cat f-gf-2-$n.po 1>&2
175 rm -f f-gf-2-$n.po f-gf-2-$n.mo