2 . "${srcdir=.}/init.sh"; path_prepend_ . ../src
4 # Test recognition of librep format strings.
6 cat <<\EOF > f-lr-1.data
9 # Valid: one character argument
11 # Valid: one integer argument
13 # Valid: one integer argument
15 # Valid: one integer argument
17 # Valid: one integer argument
19 # Valid: one object argument
21 # Valid: one object argument
23 # Valid: one argument with flags
25 # Valid: one argument with width
27 # Valid: one argument with precision
29 # Valid: one argument with width and precision
31 # Invalid: unterminated
33 # Invalid: unknown format specifier
35 # Invalid: flags after width
37 # Invalid: twice precision
39 # Valid: three arguments
41 # Valid: a numbered argument
45 # Valid: two-digit numbered arguments
46 "abc%11$def%10$dgh%9$dij%8$dkl%7$dmn%6$dop%5$dqr%4$dst%3$duv%2$dwx%1$dyz"
47 # Invalid: unterminated number
49 # Invalid: flags before number
51 # Valid: three arguments, two with same number
53 # Invalid: argument with conflicting types
57 # Valid: mixing of numbered and unnumbered arguments
59 # Valid: mixing of numbered and unnumbered arguments
61 # Valid: numbered argument with constant precision
63 # Valid: missing non-final argument
67 # Valid: multiple uses of same argument
68 "abc%2$xdef%1$Sghi%2$x"
71 : ${XGETTEXT=xgettext}
73 while read comment; do
76 cat <<EOF > f-lr-1-$n.in
79 ${XGETTEXT} -L librep -o f-lr-1-$n.po f-lr-1-$n.in || exit 1
80 test -f f-lr-1-$n.po || exit 1
82 if echo "$comment" | grep 'Valid:' > /dev/null; then
83 if grep librep-format f-lr-1-$n.po > /dev/null; then
89 if grep librep-format f-lr-1-$n.po > /dev/null; then
95 if test -n "$fail"; then
96 echo "Format string recognition error:" 1>&2
102 rm -f f-lr-1-$n.in f-lr-1-$n.po