No empty .Rs/.Re
[netbsd-mini2440.git] / gnu / dist / gettext / gettext-tools / tests / format-ycp-1
blob8cd994122f0261de34caf6b4765d8357245bce25
1 #! /bin/sh
3 # Test recognition of YCP format strings.
5 tmpfiles=""
6 trap 'rm -fr $tmpfiles' 1 2 3 15
8 tmpfiles="$tmpfiles f-y-1.data"
9 cat <<\EOF > f-y-1.data
10 # Valid: no argument
11 "abc%%def"
12 # Valid: one argument
13 "abc%1def"
14 # Valid: nine arguments
15 "abc%9def"
16 # Invalid: unterminated
17 "abc%%def%"
18 # Invalid: non-digit
19 "abc%%def%x"
20 # Invalid: zero
21 "abc%%def%0"
22 # Valid: permutation
23 "abc%2def%1"
24 # Valid: 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-y-1-$n.in f-y-1-$n.po"
34 cat <<EOF > f-y-1-$n.in
35 _(${string});
36 EOF
37 ${XGETTEXT} -L YCP -o f-y-1-$n.po f-y-1-$n.in || exit 1
38 test -f f-y-1-$n.po || exit 1
39 fail=
40 if echo "$comment" | grep 'Valid:' > /dev/null; then
41 if grep ycp-format f-y-1-$n.po > /dev/null; then
43 else
44 fail=yes
46 else
47 if grep ycp-format f-y-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-y-1-$n.in 1>&2
56 echo "Got:" 1>&2
57 cat f-y-1-$n.po 1>&2
58 exit 1
60 rm -f f-y-1-$n.in f-y-1-$n.po
61 done < f-y-1.data
63 rm -fr $tmpfiles
65 exit 0