3 # Test recognition of Java format strings.
6 trap 'rm -fr $tmpfiles' 1 2 3 15
8 tmpfiles
="$tmpfiles f-j-1.data"
9 cat <<\EOF
> f-j-1.data
12 # Valid: ten arguments
14 # Valid: two-digit argument numbers
16 # Valid: huge argument numbers
18 # Invalid: unterminated
20 # Invalid: unterminated
22 # Invalid: missing number
28 # Valid: two arguments
30 # Valid: multiple uses of same argument
32 # Invalid: broken elementFormat
34 # Invalid: invalid elementFormat
36 # Valid: elementFormat of length 1
38 # Valid: elementFormat of length 1
40 # Valid: elementFormat of length 1
42 # Valid: elementFormat of length 1
44 # Invalid: broken elementFormat
46 # Valid: builtin numberStyle
47 "abc{1,number,currency}def"
48 # Valid: builtin numberStyle
49 "abc{1,number,percent}def"
50 # Valid: builtin numberStyle
51 "abc{1,number,integer}def"
52 # Valid: builtin datetimeStyle
53 "abc{1,date,short}def"
54 # Valid: builtin datetimeStyle
55 "abc{1,date,medium}def"
56 # Valid: builtin datetimeStyle
58 # Valid: builtin datetimeStyle
60 # Valid: builtin datetimeStyle
61 "abc{1,time,short}def"
62 # Valid: builtin datetimeStyle
63 "abc{1,time,medium}def"
64 # Valid: builtin datetimeStyle
66 # Valid: builtin datetimeStyle
68 # Valid: dateFormatPattern
70 # Valid: dateFormatPattern
72 # Valid: dateFormatPattern with comma
74 # Valid: numberFormatPattern
75 "abc{1,number,###,##0}def"
76 # Invalid: numberFormatPattern
77 "abc{1,number,foobar}"
78 # Valid: empty choiceFormatPattern
80 # Valid: choiceFormatPattern
81 "abc{1,choice,0#zero|1#one|2#many}def"
82 # Invalid: empty clause in choiceFormatPattern
83 "abc{1,choice,|0#zero|1#one|2#many}def"
84 # Valid: empty clause at end of choiceFormatPattern
85 "abc{1,choice,0#zero|1#one|2#many|}def"
86 # Invalid: short clause in choiceFormatPattern
87 "abc{1,choice,-1|0#zero|1#one|2#many}def"
88 # Valid: short clause at end of choiceFormatPattern
89 "abc{1,choice,0#zero|1#one|2#many|3}def"
90 # Valid: choiceFormatPattern with different argument
91 "abc{1,choice,1#one|2#{0,date}}def"
92 # Valid: choiceFormatPattern with same argument
93 "abc{1,choice,1#one|2#{1}}def"
94 # Valid: choiceFormatPattern with same argument
95 "abc{1,choice,1#one|2#{1,number}}def"
96 # Invalid: choiceFormatPattern with same argument, type conflict
97 "abc{1,choice,1#one|2#{1,date}}def"
98 # Invalid: missing opening brace
100 # Valid: quoted brace
102 # Invalid: quoted brace
104 # Valid: unterminated quote
106 # Valid: quoted brace, '' counts as a single quote
108 # Invalid: '' counts as a single quote
110 # Valid: quote inside elementFormat is hidden
112 # Valid: numberFormatPattern with quote
113 "abc{1,number,#0';'}def"
114 # Invalid: numberFormatPattern with wrong number syntax
115 "abc{1,number,#0;}def"
116 # Valid: numberFormatPattern with quote
117 "abc{1,number,0.##'E}def"
118 # Valid: numberFormatPattern without quote
119 "abc{1,number,0.##E}def"
122 : ${XGETTEXT=xgettext}
124 while read comment
; do
127 tmpfiles
="$tmpfiles f-j-1-$n.in f-j-1-$n.po"
128 cat <<EOF > f-j-1-$n.in
131 ${XGETTEXT} -L Java
-o f-j-1-
$n.po f-j-1-
$n.
in ||
exit 1
132 test -f f-j-1-
$n.po ||
exit 1
134 if echo "$comment" |
grep 'Valid:' > /dev
/null
; then
135 if grep java-format f-j-1-
$n.po
> /dev
/null
; then
141 if grep java-format f-j-1-
$n.po
> /dev
/null
; then
147 if test -n "$fail"; then
148 echo "Format string recognition error:" 1>&2
154 rm -f f-j-1-
$n.
in f-j-1-
$n.po