~ubuntu-branches/ubuntu/breezy/gettext/breezy

« back to all changes in this revision

Viewing changes to gettext-tools/tests/format-csharp-1

  • Committer: Bazaar Package Importer
  • Author(s): Santiago Vila
  • Date: 2004-03-14 17:40:02 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040314174002-p1ad5ldve1hqzhye
Tags: 0.14.1-2
* Added libexpat1-dev to Build-Depends, for glade support.
* Added libc0.1-dev to Build-Depends, for GNU/kFreeBSD.
* Removed special-casing of knetbsd-gnu in debian/rules.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh
 
2
 
 
3
# Test recognition of C# format strings.
 
4
 
 
5
tmpfiles=""
 
6
trap 'rm -fr $tmpfiles' 1 2 3 15
 
7
 
 
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
 
51
 
 
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
 
66
      :
 
67
    else
 
68
      fail=yes
 
69
    fi
 
70
  else
 
71
    if grep csharp-format f-cs-1-$n.po > /dev/null; then
 
72
      fail=yes
 
73
    else
 
74
      :
 
75
    fi
 
76
  fi
 
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
 
83
  fi
 
84
  rm -f f-cs-1-$n.in f-cs-1-$n.po
 
85
done < f-cs-1.data
 
86
 
 
87
rm -fr $tmpfiles
 
88
 
 
89
exit 0