No empty .Rs/.Re
[netbsd-mini2440.git] / gnu / dist / gettext / gettext-tools / tests / format-ycp-2
blobdd6159e38b5d372a9dab6d57da14930807973c75
1 #! /bin/sh
3 # Test checking of YCP format strings.
5 tmpfiles=""
6 trap 'rm -fr $tmpfiles' 1 2 3 15
8 tmpfiles="$tmpfiles f-y-2.data"
9 cat <<\EOF > f-y-2.data
10 # Valid: %% doesn't count
11 msgid "abc%%def"
12 msgstr "xyz"
13 # Invalid: invalid msgstr
14 msgid "abc%%def"
15 msgstr "xyz%"
16 # Valid: same arguments
17 msgid "abc%2def"
18 msgstr "xyz%2"
19 # Valid: permutation
20 msgid "abc%3%1%2def"
21 msgstr "xyz%2%1%3"
22 # Invalid: too few arguments
23 msgid "abc%2def%1"
24 msgstr "xyz%1"
25 # Invalid: too many arguments
26 msgid "abc%1def"
27 msgstr "xyz%1uvw%2"
28 # Invalid: missing non-final argument
29 msgid "abc%2def%1"
30 msgstr "xyz%2"
31 # Invalid: added non-final argument
32 msgid "abc%2def"
33 msgstr "xyz%1%2"
34 EOF
36 : ${MSGFMT=msgfmt}
37 n=0
38 while read comment; do
39 read msgid_line
40 read msgstr_line
41 n=`expr $n + 1`
42 tmpfiles="$tmpfiles f-y-2-$n.po f-y-2-$n.mo"
43 cat <<EOF > f-y-2-$n.po
44 #, ycp-format
45 ${msgid_line}
46 ${msgstr_line}
47 EOF
48 fail=
49 if echo "$comment" | grep 'Valid:' > /dev/null; then
50 if ${MSGFMT} --check-format -o f-y-2-$n.mo f-y-2-$n.po; then
52 else
53 fail=yes
55 else
56 ${MSGFMT} --check-format -o f-y-2-$n.mo f-y-2-$n.po 2> /dev/null
57 if test $? = 1; then
59 else
60 fail=yes
63 if test -n "$fail"; then
64 echo "Format string checking error:" 1>&2
65 cat f-y-2-$n.po 1>&2
66 exit 1
68 rm -f f-y-2-$n.po f-y-2-$n.mo
69 done < f-y-2.data
71 rm -fr $tmpfiles
73 exit 0