3 # Test recognition of Tcl format strings.
6 trap 'rm -fr $tmpfiles' 1 2 3 15
8 tmpfiles
="$tmpfiles f-t-1.data"
9 cat <<\EOF
> f-t-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 # Valid: * does mix with numbered 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-t-1-$n.in f-t-1-$n.po"
110 escape_dollars
='s/\$/\\\$/g'
111 string
=`echo "$string" | sed -e "$escape_dollars"`
112 cat <<EOF > f-t-1-$n.in
113 [msgcat::mc ${string}];
115 ${XGETTEXT} -L Tcl
-o f-t-1-
$n.po f-t-1-
$n.
in ||
exit 1
116 test -f f-t-1-
$n.po ||
exit 1
118 if echo "$comment" |
grep 'Valid:' > /dev
/null
; then
119 if grep tcl-format f-t-1-
$n.po
> /dev
/null
; then
125 if grep tcl-format f-t-1-
$n.po
> /dev
/null
; then
131 if test -n "$fail"; then
132 echo "Format string recognition error:" 1>&2
138 rm -f f-t-1-
$n.
in f-t-1-
$n.po