3 # Test recognition of librep format strings.
6 trap 'rm -fr $tmpfiles' 1 2 3 15
8 tmpfiles
="$tmpfiles f-lr-1.data"
9 cat <<\EOF
> f-lr-1.data
12 # Valid: one character argument
14 # Valid: one integer argument
16 # Valid: one integer argument
18 # Valid: one integer argument
20 # Valid: one integer argument
22 # Valid: one object argument
24 # Valid: one object argument
26 # Valid: one argument with flags
28 # Valid: one argument with width
30 # Valid: one argument with precision
32 # Valid: one argument with width and precision
34 # Invalid: unterminated
36 # Invalid: unknown format specifier
38 # Invalid: flags after width
40 # Invalid: twice precision
42 # Valid: three arguments
44 # Valid: a numbered argument
48 # Valid: two-digit numbered arguments
49 "abc%11$def%10$dgh%9$dij%8$dkl%7$dmn%6$dop%5$dqr%4$dst%3$duv%2$dwx%1$dyz"
50 # Invalid: unterminated number
52 # Invalid: flags before number
54 # Valid: three arguments, two with same number
56 # Invalid: argument with conflicting types
60 # Valid: mixing of numbered and unnumbered arguments
62 # Valid: mixing of numbered and unnumbered arguments
64 # Valid: numbered argument with constant precision
66 # Valid: missing non-final argument
70 # Valid: multiple uses of same argument
71 "abc%2$xdef%1$Sghi%2$x"
74 : ${XGETTEXT=xgettext}
76 while read comment
; do
79 tmpfiles
="$tmpfiles f-lr-1-$n.in f-lr-1-$n.po"
80 cat <<EOF > f-lr-1-$n.in
83 ${XGETTEXT} -L librep
-o f-lr-1-
$n.po f-lr-1-
$n.
in ||
exit 1
84 test -f f-lr-1-
$n.po ||
exit 1
86 if echo "$comment" |
grep 'Valid:' > /dev
/null
; then
87 if grep librep-format f-lr-1-
$n.po
> /dev
/null
; then
93 if grep librep-format f-lr-1-
$n.po
> /dev
/null
; then
99 if test -n "$fail"; then
100 echo "Format string recognition error:" 1>&2
101 cat f-lr-1-
$n.
in 1>&2
103 cat f-lr-1-
$n.po
1>&2
106 rm -f f-lr-1-
$n.
in f-lr-1-
$n.po