2 . "${srcdir=.}/init.sh"; path_prepend_ . ../src
4 # Test recognition of Java format strings.
6 cat <<\EOF > f-j-1.data
11 # Valid: two-digit argument numbers
13 # Valid: huge argument numbers
15 # Invalid: unterminated
17 # Invalid: unterminated
19 # Invalid: missing number
25 # Valid: two arguments
27 # Valid: multiple uses of same argument
29 # Invalid: broken elementFormat
31 # Invalid: invalid elementFormat
33 # Valid: elementFormat of length 1
35 # Valid: elementFormat of length 1
37 # Valid: elementFormat of length 1
39 # Valid: elementFormat of length 1
41 # Invalid: broken elementFormat
43 # Valid: builtin numberStyle
44 "abc{1,number,currency}def"
45 # Valid: builtin numberStyle
46 "abc{1,number,percent}def"
47 # Valid: builtin numberStyle
48 "abc{1,number,integer}def"
49 # Valid: builtin datetimeStyle
50 "abc{1,date,short}def"
51 # Valid: builtin datetimeStyle
52 "abc{1,date,medium}def"
53 # Valid: builtin datetimeStyle
55 # Valid: builtin datetimeStyle
57 # Valid: builtin datetimeStyle
58 "abc{1,time,short}def"
59 # Valid: builtin datetimeStyle
60 "abc{1,time,medium}def"
61 # Valid: builtin datetimeStyle
63 # Valid: builtin datetimeStyle
65 # Valid: dateFormatPattern
67 # Valid: dateFormatPattern
69 # Valid: dateFormatPattern with comma
71 # Valid: numberFormatPattern
72 "abc{1,number,###,##0}def"
73 # Invalid: numberFormatPattern
74 "abc{1,number,foobar}"
75 # Valid: empty choiceFormatPattern
77 # Valid: choiceFormatPattern
78 "abc{1,choice,0#zero|1#one|2#many}def"
79 # Invalid: empty clause in choiceFormatPattern
80 "abc{1,choice,|0#zero|1#one|2#many}def"
81 # Valid: empty clause at end of choiceFormatPattern
82 "abc{1,choice,0#zero|1#one|2#many|}def"
83 # Invalid: short clause in choiceFormatPattern
84 "abc{1,choice,-1|0#zero|1#one|2#many}def"
85 # Valid: short clause at end of choiceFormatPattern
86 "abc{1,choice,0#zero|1#one|2#many|3}def"
87 # Valid: choiceFormatPattern with different argument
88 "abc{1,choice,1#one|2#{0,date}}def"
89 # Valid: choiceFormatPattern with same argument
90 "abc{1,choice,1#one|2#{1}}def"
91 # Valid: choiceFormatPattern with same argument
92 "abc{1,choice,1#one|2#{1,number}}def"
93 # Invalid: choiceFormatPattern with same argument, type conflict
94 "abc{1,choice,1#one|2#{1,date}}def"
95 # Invalid: missing opening brace
99 # Invalid: quoted brace
101 # Valid: unterminated quote
103 # Valid: quoted brace, '' counts as a single quote
105 # Invalid: '' counts as a single quote
107 # Valid: quote inside elementFormat is hidden
109 # Valid: numberFormatPattern with quote
110 "abc{1,number,#0';'}def"
111 # Invalid: numberFormatPattern with wrong number syntax
112 "abc{1,number,#0;}def"
113 # Valid: numberFormatPattern with quote
114 "abc{1,number,0.##'E}def"
115 # Valid: numberFormatPattern without quote
116 "abc{1,number,0.##E}def"
119 : ${XGETTEXT=xgettext}
121 while read comment; do
124 cat <<EOF > f-j-1-$n.in
127 ${XGETTEXT} -L Java -o f-j-1-$n.po f-j-1-$n.in || exit 1
128 test -f f-j-1-$n.po || exit 1
130 if echo "$comment" | grep 'Valid:' > /dev/null; then
131 if grep java-format f-j-1-$n.po > /dev/null; then
137 if grep java-format f-j-1-$n.po > /dev/null; then
143 if test -n "$fail"; then
144 echo "Format string recognition error:" 1>&2
150 rm -f f-j-1-$n.in f-j-1-$n.po