No empty .Rs/.Re
[netbsd-mini2440.git] / gnu / dist / gettext / gettext-tools / tests / format-qt-1
blob74df988a1f7e24ffcf0657202c755b049d4f2251
1 #! /bin/sh
3 # Test recognition of Qt format strings.
5 tmpfiles=""
6 trap 'rm -fr $tmpfiles' 1 2 3 15
8 tmpfiles="$tmpfiles f-qt-1.data"
9 cat <<\EOF > f-qt-1.data
10 # Unrecognized: no argument
11 "abc%%def"
12 # Valid: one argument
13 "abc%1def"
14 # Valid: one argument
15 "abc%9def"
16 # Valid: unterminated
17 "abc%1def%"
18 # Valid: non-digit
19 "abc%1def%x"
20 # Valid: zero
21 "abc%1def%0"
22 # Valid: permutation
23 "abc%2def%1"
24 # Invalid: multiple uses of same argument
25 "abc%2def%1ghi%2"
26 EOF
28 : ${XGETTEXT=xgettext}
29 n=0
30 while read comment; do
31 read string
32 n=`expr $n + 1`
33 tmpfiles="$tmpfiles f-qt-1-$n.in f-qt-1-$n.po"
34 cat <<EOF > f-qt-1-$n.in
35 _(${string});
36 EOF
37 ${XGETTEXT} -L C++ --qt -k_ -o f-qt-1-$n.po f-qt-1-$n.in || exit 1
38 test -f f-qt-1-$n.po || exit 1
39 fail=
40 if echo "$comment" | grep 'Valid:' > /dev/null; then
41 if grep qt-format f-qt-1-$n.po > /dev/null; then
43 else
44 fail=yes
46 else
47 if grep qt-format f-qt-1-$n.po > /dev/null; then
48 fail=yes
49 else
53 if test -n "$fail"; then
54 echo "Format string recognition error:" 1>&2
55 cat f-qt-1-$n.in 1>&2
56 echo "Got:" 1>&2
57 cat f-qt-1-$n.po 1>&2
58 exit 1
60 rm -f f-qt-1-$n.in f-qt-1-$n.po
61 done < f-qt-1.data
63 rm -fr $tmpfiles
65 exit 0