3 # Test checking of Java format strings.
6 trap 'rm -fr $tmpfiles' 1 2 3 15
8 tmpfiles
="$tmpfiles f-j-2.data"
9 cat <<\EOF
> f-j-2.data
10 # Invalid: invalid msgstr
13 # Valid: same arguments
16 # Valid: same arguments, differently written
20 msgid
"abc{2}{0}{1}def"
22 # Invalid: too few arguments
25 # Invalid: too many arguments
28 # Invalid: missing non-final argument
31 # Invalid: added non-final argument
34 # Invalid: different number of arguments
35 msgid
"abc{500000000}def"
36 msgstr
"xyz{500000001}"
37 # Valid: type compatibility
39 msgstr
"xyz{1,choice,0#zero|1#{1,number}}"
40 # Valid: type compatibility
42 msgstr
"xyz{1,number,currency}"
43 # Valid: type compatibility
45 msgstr
"xyz{1,number,percent}"
46 # Valid: type compatibility
48 msgstr
"xyz{1,number,integer}"
49 # Valid: type compatibility
51 msgstr
"xyz{1,number,###,##0}"
52 # Valid: type compatibility
55 # Valid: type compatibility
57 msgstr
"xyz{1,date,short}"
58 # Valid: type compatibility
60 msgstr
"xyz{1,date,medium}"
61 # Valid: type compatibility
63 msgstr
"xyz{1,date,long}"
64 # Valid: type compatibility
66 msgstr
"xyz{1,date,full}"
67 # Valid: type compatibility
69 msgstr
"xyz{1,date,yyyy-MM-dd}"
70 # Valid: type compatibility
72 msgstr
"xyz{1,time,short}"
73 # Valid: type compatibility
75 msgstr
"xyz{1,time,medium}"
76 # Valid: type compatibility
78 msgstr
"xyz{1,time,long}"
79 # Valid: type compatibility
81 msgstr
"xyz{1,time,full}"
82 # Valid: type compatibility
85 # Valid: type compatibility
87 msgstr
"xyz{1,time,hh:mm:ss}"
88 # Invalid: type incompatibility
90 msgstr
"xyz{1,number}"
91 # Invalid: type incompatibility
94 # Invalid: type incompatibility
96 msgstr
"xyz{1,number}"
97 # Invalid: type incompatibility
100 # Invalid: type incompatibility
102 msgstr
"xyz{1,choice,0#zero|1#{1,number}}"
103 # Invalid: type incompatibility
105 msgstr
"xyz{1,choice,0#zero|1#{0,number}}"
106 # Invalid: type incompatibility
107 msgid
"abc{0,number}{1}"
108 msgstr
"xyz{0,choice,0#zero|1#{1,number}}"
113 while read comment
; do
117 tmpfiles
="$tmpfiles f-j-2-$n.po f-j-2-$n.mo"
118 cat <<EOF > f-j-2-$n.po
124 if echo "$comment" |
grep 'Valid:' > /dev
/null
; then
125 if ${MSGFMT} --check-format -o f-j-2-
$n.mo f-j-2-
$n.po
; then
131 ${MSGFMT} --check-format -o f-j-2-
$n.mo f-j-2-
$n.po
2> /dev
/null
138 if test -n "$fail"; then
139 echo "Format string checking error:" 1>&2
143 rm -f f-j-2-
$n.po f-j-2-
$n.mo