2 . "${srcdir=.}/init.sh"; path_prepend_ . ../src
4 # Test recognition of Tcl format strings.
6 cat <<\EOF > f-t-1.data
9 # Valid: one character argument
11 # Valid: one string argument
13 # Valid: one integer argument
15 # Valid: one integer argument
17 # Valid: one integer argument
19 # Valid: one integer argument
21 # Valid: one integer argument
23 # Valid: one integer argument
25 # Valid: one floating-point argument
27 # Valid: one floating-point argument
29 # Valid: one floating-point argument
31 # Valid: one floating-point argument
33 # Valid: one floating-point argument
35 # Valid: one argument with flags
37 # Valid: one argument with width
39 # Valid: one argument with width
41 # Valid: one argument with precision
43 # Valid: one argument with precision
45 # Valid: one argument with width and precision
47 # Valid: one argument with width and precision
49 # Valid: one argument with width and precision
51 # Valid: one argument with width and precision
53 # Invalid: unterminated
55 # Invalid: unknown format specifier
57 # Invalid: unknown format specifier
59 # Invalid: flags after width
61 # Invalid: twice precision
63 # Valid: three arguments
65 # Valid: a numbered argument
69 # Valid: two-digit numbered arguments
70 "abc%11$def%10$dgh%9$dij%8$dkl%7$dmn%6$dop%5$dqr%4$dst%3$duv%2$dwx%1$dyz"
71 # Invalid: unterminated number
73 # Invalid: flags before number
75 # Valid: three arguments, two with same number
77 # Invalid: argument with conflicting types
81 # Invalid: mixing of numbered and unnumbered arguments
83 # Valid: numbered argument with constant precision
85 # Valid: * does mix with numbered arguments
87 # Valid: missing non-final argument
91 # Valid: multiple uses of same argument
92 "abc%2$xdef%1$sghi%2$x"
93 # Valid: one argument with width
95 # Valid: one argument with width and precision
101 : ${XGETTEXT=xgettext}
103 while read comment; do
106 escape_dollars='s/\$/\\\$/g'
107 string=`echo "$string" | sed -e "$escape_dollars"`
108 cat <<EOF > f-t-1-$n.in
109 [msgcat::mc ${string}];
111 ${XGETTEXT} -L Tcl -o f-t-1-$n.po f-t-1-$n.in || exit 1
112 test -f f-t-1-$n.po || exit 1
114 if echo "$comment" | grep 'Valid:' > /dev/null; then
115 if grep tcl-format f-t-1-$n.po > /dev/null; then
121 if grep tcl-format f-t-1-$n.po > /dev/null; then
127 if test -n "$fail"; then
128 echo "Format string recognition error:" 1>&2
134 rm -f f-t-1-$n.in f-t-1-$n.po