No empty .Rs/.Re
[netbsd-mini2440.git] / gnu / dist / gettext / gettext-tools / tests / format-csharp-1
blobc6ed6068e0348112586b1988a7a34e60ec96e982
1 #! /bin/sh
3 # Test recognition of C# format strings.
5 tmpfiles=""
6 trap 'rm -fr $tmpfiles' 1 2 3 15
8 tmpfiles="$tmpfiles f-cs-1.data"
9 cat <<\EOF > f-cs-1.data
10 # Valid: one argument
11 "abc{0}def"
12 # Valid: ten arguments
13 "abc{9}def"
14 # Valid: two-digit argument numbers
15 "abc{00}def"
16 # Valid: huge argument numbers
17 "abc{500000000}def"
18 # Invalid: unterminated
19 "abc{"
20 # Invalid: unterminated
21 "abc{0"
22 # Invalid: missing number
23 "abc{}def"
24 # Invalid: non-digit
25 "abc{number}def"
26 # Invalid: non-digit
27 "abc{-0}def"
28 # Valid: two arguments
29 "abc{1}def{0}"
30 # Valid: multiple uses of same argument
31 "abc{1}def{0}ghi{1}"
32 # Invalid: invalid width
33 "abc{0,}def"
34 # Invalid: invalid width
35 "abc{0,-}def"
36 # Valid: valid width
37 "abc{1,-7}def"
38 # Valid: format specifiers
39 "abc{1:Gx N}def"
40 # Valid: width and format specifiers
41 "abc{1,3:Gx N}def"
42 # Invalid: missing opening brace
43 "abc1}def{0}"
44 # Invalid: quoted brace
45 "abc1'}'def{0}"
46 # Valid: doubled brace
47 "abc1}}def{0}"
48 # Invalid: doubled brace doesn't start a directive
49 "abc{{0}def"
50 EOF
52 : ${XGETTEXT=xgettext}
53 n=0
54 while read comment; do
55 read string
56 n=`expr $n + 1`
57 tmpfiles="$tmpfiles f-cs-1-$n.in f-cs-1-$n.po"
58 cat <<EOF > f-cs-1-$n.in
59 GetString(${string});
60 EOF
61 ${XGETTEXT} -L C# -o f-cs-1-$n.po f-cs-1-$n.in || exit 1
62 test -f f-cs-1-$n.po || exit 1
63 fail=
64 if echo "$comment" | grep 'Valid:' > /dev/null; then
65 if grep csharp-format f-cs-1-$n.po > /dev/null; then
67 else
68 fail=yes
70 else
71 if grep csharp-format f-cs-1-$n.po > /dev/null; then
72 fail=yes
73 else
77 if test -n "$fail"; then
78 echo "Format string recognition error:" 1>&2
79 cat f-cs-1-$n.in 1>&2
80 echo "Got:" 1>&2
81 cat f-cs-1-$n.po 1>&2
82 exit 1
84 rm -f f-cs-1-$n.in f-cs-1-$n.po
85 done < f-cs-1.data
87 rm -fr $tmpfiles
89 exit 0