No empty .Rs/.Re
[netbsd-mini2440.git] / gnu / dist / gettext / gettext-tools / tests / format-csharp-2
blob9180bc1c4c408618161679e87ed92f5761a4db0f
1 #! /bin/sh
3 # Test checking of Java format strings.
5 tmpfiles=""
6 trap 'rm -fr $tmpfiles' 1 2 3 15
8 tmpfiles="$tmpfiles f-cs-2.data"
9 cat <<\EOF > f-cs-2.data
10 # Invalid: invalid msgstr
11 msgid "abc{0}def"
12 msgstr "abc{"
13 # Valid: same arguments
14 msgid "abc{1}def"
15 msgstr "xyz{1}"
16 # Valid: same arguments, differently written
17 msgid "abc{1}def"
18 msgstr "xyz{01}"
19 # Valid: permutation
20 msgid "abc{2}{0}{1}def"
21 msgstr "xyz{1}{0}{2}"
22 # Invalid: too few arguments
23 msgid "abc{1}def{0}"
24 msgstr "xyz{0}"
25 # Invalid: too many arguments
26 msgid "abc{0}def"
27 msgstr "xyz{0}uvw{1}"
28 # Valid: missing non-final argument
29 msgid "abc{1}def{0}"
30 msgstr "xyz{1}"
31 # Valid: added non-final argument
32 msgid "abc{1}def"
33 msgstr "xyz{0}{1}"
34 # Invalid: different number of arguments
35 msgid "abc{500000000}def"
36 msgstr "xyz{500000001}"
37 # Valid: type compatibility
38 msgid "abc{1:X}"
39 msgstr "xyz{1:g}"
40 EOF
42 : ${MSGFMT=msgfmt}
43 n=0
44 while read comment; do
45 read msgid_line
46 read msgstr_line
47 n=`expr $n + 1`
48 tmpfiles="$tmpfiles f-cs-2-$n.po f-cs-2-$n.mo"
49 cat <<EOF > f-cs-2-$n.po
50 #, csharp-format
51 ${msgid_line}
52 ${msgstr_line}
53 EOF
54 fail=
55 if echo "$comment" | grep 'Valid:' > /dev/null; then
56 if ${MSGFMT} --check-format -o f-cs-2-$n.mo f-cs-2-$n.po; then
58 else
59 fail=yes
61 else
62 ${MSGFMT} --check-format -o f-cs-2-$n.mo f-cs-2-$n.po 2> /dev/null
63 if test $? = 1; then
65 else
66 fail=yes
69 if test -n "$fail"; then
70 echo "Format string checking error:" 1>&2
71 cat f-cs-2-$n.po 1>&2
72 exit 1
74 rm -f f-cs-2-$n.po f-cs-2-$n.mo
75 done < f-cs-2.data
77 rm -fr $tmpfiles
79 exit 0