2 . "${srcdir=.}/init.sh"; path_prepend_ . ../src
4 # Test recognition of JavaScript format strings.
6 cat <<\EOF > f-js-1.data
9 # Valid: one character argument
11 # Valid: one string argument
13 # Valid: one integer argument
15 # Valid: one integer argument
17 # Valid: one integer argument
19 # Valid: one integer argument
21 # Valid: one integer argument
23 # Valid: one floating-point argument
25 # Valid: one object argument
27 # Valid: one argument with flags
29 # Valid: one argument with width
31 # Valid: one argument with precision
33 # Valid: one argument with width and precision
35 # Invalid: unterminated
37 # Invalid: unknown format specifier
39 # Invalid: flags after width
41 # Invalid: twice precision
43 # Valid: three arguments
47 : ${XGETTEXT=xgettext}
49 while read comment; do
52 cat <<EOF > f-js-1-$n.in
55 # Hide xgettext's "The translator cannot reorder the arguments." warnings.
56 ${XGETTEXT} -L JavaScript -o f-js-1-$n.po f-js-1-$n.in 2> f-js-1.err \
57 || { cat f-js-1.err 1>&2; exit 1; }
58 test -f f-js-1-$n.po || exit 1
60 if echo "$comment" | grep 'Valid:' > /dev/null; then
61 if grep javascript-format f-js-1-$n.po > /dev/null; then
67 if grep javascript-format f-js-1-$n.po > /dev/null; then
73 if test -n "$fail"; then
74 echo "Format string recognition error:" 1>&2
80 rm -f f-js-1-$n.in f-js-1-$n.po