No empty .Rs/.Re
[netbsd-mini2440.git] / gnu / dist / gettext / gettext-tools / tests / format-gcc-internal-1
blobe47626e73be71097b892535d39bd32ddfdcc347e
1 #! /bin/sh
3 # Test recognition of GCC internal format strings.
5 tmpfiles=""
6 trap 'rm -fr $tmpfiles' 1 2 3 15
8 tmpfiles="$tmpfiles f-gi-1.data"
9 cat <<\EOF > f-gi-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 and one string argument
27 "abc%.*s"
28 # Valid: one pointer argument
29 "abc%H"
30 # Valid: one pointer argument
31 "abc%D"
32 # Valid: one pointer argument
33 "abc%F"
34 # Valid: one pointer argument
35 "abc%T"
36 # Valid: one pointer argument
37 "abc%A"
38 # Valid: one pointer argument
39 "abc%C"
40 # Valid: one pointer argument
41 "abc%E"
42 # Valid: one pointer argument
43 "abc%L"
44 # Valid: one pointer argument
45 "abc%O"
46 # Valid: one pointer argument
47 "abc%P"
48 # Valid: one pointer argument
49 "abc%Q"
50 # Valid: one pointer argument
51 "abc%V"
52 # Valid: one argument with flags
53 "abc%+#Ag"
54 # Valid: one argument with size specifier
55 "abc%li"
56 # Invalid: unterminated
57 "abc%"
58 # Invalid: unknown format specifier
59 "abc%y"
60 # Invalid: precision with non-string
61 "abc%.*c"
62 # Invalid: twice precision
63 "abc%.*.*s"
64 # Valid: three arguments
65 "abc%d%u%u"
66 # Invalid: a numbered argument
67 "abc%1$d"
68 EOF
70 : ${XGETTEXT=xgettext}
71 n=0
72 while read comment; do
73 read string
74 n=`expr $n + 1`
75 tmpfiles="$tmpfiles f-gi-1-$n.in f-gi-1-$n.po"
76 cat <<EOF > f-gi-1-$n.in
77 gettext(${string});
78 EOF
79 ${XGETTEXT} -L GCC-source -o f-gi-1-$n.po f-gi-1-$n.in || exit 1
80 test -f f-gi-1-$n.po || exit 1
81 fail=
82 if echo "$comment" | grep 'Valid:' > /dev/null; then
83 if grep gcc-internal-format f-gi-1-$n.po > /dev/null; then
85 else
86 fail=yes
88 else
89 if grep gcc-internal-format f-gi-1-$n.po > /dev/null; then
90 fail=yes
91 else
95 if test -n "$fail"; then
96 echo "Format string recognition error:" 1>&2
97 cat f-gi-1-$n.in 1>&2
98 echo "Got:" 1>&2
99 cat f-gi-1-$n.po 1>&2
100 exit 1
102 rm -f f-gi-1-$n.in f-gi-1-$n.po
103 done < f-gi-1.data
105 rm -fr $tmpfiles
107 exit 0