2 . "${srcdir=.}/init.sh"; path_prepend_ . ../src
4 # Test checking of Java format strings.
6 cat <<\EOF > f-j-2.data
7 # Invalid: invalid msgstr
10 # Valid: same arguments
13 # Valid: same arguments, differently written
17 msgid "abc{2}{0}{1}def"
19 # Invalid: too few arguments
22 # Invalid: too many arguments
25 # Invalid: missing non-final argument
28 # Invalid: added non-final argument
31 # Invalid: different number of arguments
32 msgid "abc{500000000}def"
33 msgstr "xyz{500000001}"
34 # Valid: type compatibility
36 msgstr "xyz{1,choice,0#zero|1#{1,number}}"
37 # Valid: type compatibility
39 msgstr "xyz{1,number,currency}"
40 # Valid: type compatibility
42 msgstr "xyz{1,number,percent}"
43 # Valid: type compatibility
45 msgstr "xyz{1,number,integer}"
46 # Valid: type compatibility
48 msgstr "xyz{1,number,###,##0}"
49 # Valid: type compatibility
52 # Valid: type compatibility
54 msgstr "xyz{1,date,short}"
55 # Valid: type compatibility
57 msgstr "xyz{1,date,medium}"
58 # Valid: type compatibility
60 msgstr "xyz{1,date,long}"
61 # Valid: type compatibility
63 msgstr "xyz{1,date,full}"
64 # Valid: type compatibility
66 msgstr "xyz{1,date,yyyy-MM-dd}"
67 # Valid: type compatibility
69 msgstr "xyz{1,time,short}"
70 # Valid: type compatibility
72 msgstr "xyz{1,time,medium}"
73 # Valid: type compatibility
75 msgstr "xyz{1,time,long}"
76 # Valid: type compatibility
78 msgstr "xyz{1,time,full}"
79 # Valid: type compatibility
82 # Valid: type compatibility
84 msgstr "xyz{1,time,hh:mm:ss}"
85 # Invalid: type incompatibility
87 msgstr "xyz{1,number}"
88 # Invalid: type incompatibility
91 # Invalid: type incompatibility
93 msgstr "xyz{1,number}"
94 # Invalid: type incompatibility
97 # Invalid: type incompatibility
99 msgstr "xyz{1,choice,0#zero|1#{1,number}}"
100 # Invalid: type incompatibility
102 msgstr "xyz{1,choice,0#zero|1#{0,number}}"
103 # Invalid: type incompatibility
104 msgid "abc{0,number}{1}"
105 msgstr "xyz{0,choice,0#zero|1#{1,number}}"
110 while read comment; do
114 cat <<EOF > f-j-2-$n.po
120 if echo "$comment" | grep 'Valid:' > /dev/null; then
121 if ${MSGFMT} --check-format -o f-j-2-$n.mo f-j-2-$n.po; then
127 ${MSGFMT} --check-format -o f-j-2-$n.mo f-j-2-$n.po 2> /dev/null
134 if test -n "$fail"; then
135 echo "Format string checking error:" 1>&2
139 rm -f f-j-2-$n.po f-j-2-$n.mo