3 # Test recognition of awk format strings.
6 trap 'rm -fr $tmpfiles' 1 2 3 15
8 tmpfiles
="$tmpfiles f-a-1.data"
9 cat <<\EOF
> f-a-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 integer argument
28 # Valid: one floating-point argument
30 # Valid: one floating-point argument
32 # Valid: one floating-point argument
34 # Valid: one floating-point argument
36 # Valid: one floating-point argument
38 # Valid: one argument with flags
40 # Valid: one argument with width
42 # Valid: one argument with width
44 # Valid: one argument with precision
46 # Valid: one argument with precision
48 # Valid: one argument with width and precision
50 # Valid: one argument with width and precision
52 # Valid: one argument with width and precision
54 # Valid: one argument with width and precision
56 # Invalid: unterminated
58 # Invalid: unknown format specifier
60 # Invalid: unknown format specifier
62 # Invalid: flags after width
64 # Invalid: twice precision
66 # Valid: three arguments
68 # Valid: a numbered argument
72 # Valid: two-digit numbered arguments
73 "abc%11$def%10$dgh%9$dij%8$dkl%7$dmn%6$dop%5$dqr%4$dst%3$duv%2$dwx%1$dyz"
74 # Invalid: unterminated number
76 # Invalid: flags before number
78 # Valid: three arguments, two with same number
80 # Invalid: argument with conflicting types
84 # Invalid: mixing of numbered and unnumbered arguments
86 # Valid: numbered argument with constant precision
88 # Invalid: mixing of numbered and unnumbered arguments
90 # Valid: missing non-final argument
94 # Valid: multiple uses of same argument
95 "abc%2$xdef%1$sghi%2$x"
96 # Valid: one argument with width
98 # Valid: one argument with width and precision
104 : ${XGETTEXT=xgettext}
106 while read comment
; do
109 tmpfiles
="$tmpfiles f-a-1-$n.in f-a-1-$n.po"
110 cat <<EOF > f-a-1-$n.in
111 dcgettext(${string});
113 ${XGETTEXT} -L awk -o f-a-1-
$n.po f-a-1-
$n.
in ||
exit 1
114 test -f f-a-1-
$n.po ||
exit 1
116 if echo "$comment" |
grep 'Valid:' > /dev
/null
; then
117 if grep awk-format f-a-1-
$n.po
> /dev
/null
; then
123 if grep awk-format f-a-1-
$n.po
> /dev
/null
; then
129 if test -n "$fail"; then
130 echo "Format string recognition error:" 1>&2
136 rm -f f-a-1-
$n.
in f-a-1-
$n.po