3 # Test recognition of JavaScript format strings.
6 trap 'rm -fr $tmpfiles' 1 2 3 15
8 tmpfiles="$tmpfiles f-js-1.data"
9 cat <<\EOF > f-js-1.data
12 # Valid: one character argument
14 # Valid: one string argument
16 # Valid: one integer argument
18 # Valid: one integer argument
20 # Valid: one integer argument
22 # Valid: one integer argument
24 # Valid: one integer argument
26 # Valid: one floating-point argument
28 # Valid: one object argument
30 # Valid: one argument with flags
32 # Valid: one argument with width
34 # Valid: one argument with precision
36 # Valid: one argument with width and precision
38 # Invalid: unterminated
40 # Invalid: unknown format specifier
42 # Invalid: flags after width
44 # Invalid: twice precision
46 # Valid: three arguments
50 tmpfiles="$tmpfiles f-js-1.err"
51 : ${XGETTEXT=xgettext}
53 while read comment; do
56 tmpfiles="$tmpfiles f-js-1-$n.in f-js-1-$n.po"
57 cat <<EOF > f-js-1-$n.in
60 # Hide xgettext's "The translator cannot reorder the arguments." warnings.
61 ${XGETTEXT} -L JavaScript -o f-js-1-$n.po f-js-1-$n.in 2> f-js-1.err \
62 || { cat f-js-1.err 1>&2; exit 1; }
63 test -f f-js-1-$n.po || exit 1
65 if echo "$comment" | grep 'Valid:' > /dev/null; then
66 if grep javascript-format f-js-1-$n.po > /dev/null; then
72 if grep javascript-format f-js-1-$n.po > /dev/null; then
78 if test -n "$fail"; then
79 echo "Format string recognition error:" 1>&2
85 rm -f f-js-1-$n.in f-js-1-$n.po