3 # Test recognition of Perl format strings.
6 trap 'rm -fr $tmpfiles' 1 2 3 15
8 tmpfiles
="$tmpfiles f-pl-1.data"
9 cat <<\EOF
> f-pl-1.data
12 # Valid: one small integer argument
14 # Valid: one string argument
16 # Valid: one scalar vector argument
18 # Valid: one pointer argument
20 # Valid: one integer argument
22 # Valid: one integer argument
24 # Valid: one integer argument
26 # Valid: one integer argument
28 # Valid: one integer argument
30 # Valid: one integer argument
32 # Valid: one integer argument
34 # Valid: one integer argument
36 # Valid: one integer argument
38 # Valid: one integer argument
40 # Valid: one floating-point argument
42 # Valid: one floating-point argument
44 # Valid: one floating-point argument
46 # Valid: one floating-point argument
48 # Valid: one floating-point argument
50 # Valid: one floating-point argument
52 # Valid: one argument with flags
54 # Valid: one argument with width
56 # Valid: one argument with width
58 # Valid: one argument with precision
60 # Valid: one argument with precision
62 # Valid: one argument with width and precision
64 # Valid: one argument with width and precision
66 # Valid: one argument with width and precision
68 # Valid: one argument with width and precision
70 # Valid: one argument with size specifier
72 # Valid: one argument with size specifier
74 # Valid: one argument with size specifier
76 # Valid: one argument with size specifier
78 # Valid: one argument with size specifier
80 # Valid: one argument with size specifier
82 # Valid: one argument with size specifier
84 # Valid: one argument with size specifier
86 # Valid: one argument with size specifier
88 # Invalid: unterminated
90 # Invalid: unknown format specifier
92 # Invalid: flags after width
94 # Invalid: twice precision
96 # Valid: three arguments
98 # Valid: a numbered argument
102 # Valid: two-digit numbered arguments
103 "abc%11$def%10$dgh%9$dij%8$dkl%7$dmn%6$dop%5$dqr%4$dst%3$duv%2$dwx%1$dyz"
104 # Invalid: unterminated number
106 # Invalid: flags before number
108 # Valid: three arguments, two with same number
110 # Invalid: argument with conflicting types
114 # Valid: mixing of numbered and unnumbered arguments
116 # Valid: numbered argument with constant precision
118 # Valid: mixing of numbered and unnumbered arguments
120 # Valid: missing non-final argument
124 # Valid: multiple uses of same argument
125 "abc%2$xdef%1$pghi%2$x"
126 # Valid: one argument with width
128 # Valid: one argument with width and precision
134 : ${XGETTEXT=xgettext}
136 while read comment
; do
139 tmpfiles
="$tmpfiles f-pl-1-$n.in f-pl-1-$n.po"
140 sed -e 's,\$,\\$,g' <<EOF > f-pl-1-$n.in
143 ${XGETTEXT} -L Perl
-o f-pl-1-
$n.po f-pl-1-
$n.
in ||
exit 1
144 test -f f-pl-1-
$n.po ||
exit 1
146 if echo "$comment" |
grep 'Valid:' > /dev
/null
; then
147 if grep perl-format f-pl-1-
$n.po
> /dev
/null
; then
153 if grep perl-format f-pl-1-
$n.po
> /dev
/null
; then
159 if test -n "$fail"; then
160 echo "Format string recognition error:" 1>&2
161 cat f-pl-1-
$n.
in 1>&2
163 cat f-pl-1-
$n.po
1>&2
166 rm -f f-pl-1-
$n.
in f-pl-1-
$n.po