No empty .Rs/.Re
[netbsd-mini2440.git] / gnu / dist / gettext / gettext-tools / tests / format-awk-1
blob3228eb16eceba9392c6589b1395a1b78ab11b5ab
1 #! /bin/sh
3 # Test recognition of awk format strings.
5 tmpfiles=""
6 trap 'rm -fr $tmpfiles' 1 2 3 15
8 tmpfiles="$tmpfiles f-a-1.data"
9 cat <<\EOF > f-a-1.data
10 # Valid: no argument
11 "abc%%"
12 # Valid: one character argument
13 "abc%c"
14 # Valid: one string argument
15 "abc%s"
16 # Valid: one integer argument
17 "abc%i"
18 # Valid: one integer argument
19 "abc%d"
20 # Valid: one integer argument
21 "abc%o"
22 # Valid: one integer argument
23 "abc%u"
24 # Valid: one integer argument
25 "abc%x"
26 # Valid: one integer argument
27 "abc%X"
28 # Valid: one floating-point argument
29 "abc%e"
30 # Valid: one floating-point argument
31 "abc%E"
32 # Valid: one floating-point argument
33 "abc%f"
34 # Valid: one floating-point argument
35 "abc%g"
36 # Valid: one floating-point argument
37 "abc%G"
38 # Valid: one argument with flags
39 "abc%0#g"
40 # Valid: one argument with width
41 "abc%2g"
42 # Valid: one argument with width
43 "abc%*g"
44 # Valid: one argument with precision
45 "abc%.4g"
46 # Valid: one argument with precision
47 "abc%.*g"
48 # Valid: one argument with width and precision
49 "abc%14.4g"
50 # Valid: one argument with width and precision
51 "abc%14.*g"
52 # Valid: one argument with width and precision
53 "abc%*.4g"
54 # Valid: one argument with width and precision
55 "abc%*.*g"
56 # Invalid: unterminated
57 "abc%"
58 # Invalid: unknown format specifier
59 "abc%y"
60 # Invalid: unknown format specifier
61 "abc%F"
62 # Invalid: flags after width
63 "abc%*0g"
64 # Invalid: twice precision
65 "abc%.4.2g"
66 # Valid: three arguments
67 "abc%d%u%u"
68 # Valid: a numbered argument
69 "abc%1$d"
70 # Invalid: zero
71 "abc%0$d"
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
75 "abc%1"
76 # Invalid: flags before number
77 "abc%+1$d"
78 # Valid: three arguments, two with same number
79 "abc%1$4x,%2$c,%1$u"
80 # Invalid: argument with conflicting types
81 "abc%1$4x,%2$c,%1$s"
82 # Valid: no conflict
83 "abc%1$4x,%2$c,%1$u"
84 # Invalid: mixing of numbered and unnumbered arguments
85 "abc%d%2$x"
86 # Valid: numbered argument with constant precision
87 "abc%1$.9x"
88 # Invalid: mixing of numbered and unnumbered arguments
89 "abc%1$.*x"
90 # Valid: missing non-final argument
91 "abc%2$x%3$s"
92 # Valid: permutation
93 "abc%2$ddef%1$d"
94 # Valid: multiple uses of same argument
95 "abc%2$xdef%1$sghi%2$x"
96 # Valid: one argument with width
97 "abc%2$#*1$g"
98 # Valid: one argument with width and precision
99 "abc%3$*2$.*1$g"
100 # Invalid: zero
101 "abc%2$*0$.*1$g"
104 : ${XGETTEXT=xgettext}
106 while read comment; do
107 read string
108 n=`expr $n + 1`
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
115 fail=
116 if echo "$comment" | grep 'Valid:' > /dev/null; then
117 if grep awk-format f-a-1-$n.po > /dev/null; then
119 else
120 fail=yes
122 else
123 if grep awk-format f-a-1-$n.po > /dev/null; then
124 fail=yes
125 else
129 if test -n "$fail"; then
130 echo "Format string recognition error:" 1>&2
131 cat f-a-1-$n.in 1>&2
132 echo "Got:" 1>&2
133 cat f-a-1-$n.po 1>&2
134 exit 1
136 rm -f f-a-1-$n.in f-a-1-$n.po
137 done < f-a-1.data
139 rm -fr $tmpfiles
141 exit 0