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

« back to all changes in this revision

Viewing changes to gettext-tools/tests/format-librep-2

  • 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 checking of librep format strings.
 
4
 
 
5
tmpfiles=""
 
6
trap 'rm -fr $tmpfiles' 1 2 3 15
 
7
 
 
8
tmpfiles="$tmpfiles f-lr-2.data"
 
9
cat <<\EOF > f-lr-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%s%xdef"
 
18
msgstr "xyz%s%x"
 
19
# Valid: same arguments, with different widths
 
20
msgid  "abc%2sdef"
 
21
msgstr "xyz%3s"
 
22
# Valid: same arguments but in numbered syntax
 
23
msgid  "abc%s%xdef"
 
24
msgstr "xyz%1$s%2$x"
 
25
# Valid: permutation
 
26
msgid  "abc%s%x%cdef"
 
27
msgstr "xyz%3$c%2$x%1$s"
 
28
# Invalid: too few arguments
 
29
msgid  "abc%2$xdef%1$s"
 
30
msgstr "xyz%1$s"
 
31
# Invalid: too few arguments
 
32
msgid  "abc%sdef%x"
 
33
msgstr "xyz%s"
 
34
# Invalid: too many arguments
 
35
msgid  "abc%xdef"
 
36
msgstr "xyz%xvw%c"
 
37
# Valid: same numbered arguments, with different widths
 
38
msgid  "abc%2$5s%1$4s"
 
39
msgstr "xyz%2$4s%1$5s"
 
40
# Invalid: missing argument
 
41
msgid  "abc%2$sdef%1$x"
 
42
msgstr "xyz%1$x"
 
43
# Invalid: missing argument
 
44
msgid  "abc%1$sdef%2$x"
 
45
msgstr "xyz%2$x"
 
46
# Invalid: added argument
 
47
msgid  "abc%1$xdef"
 
48
msgstr "xyz%1$xvw%2$c"
 
49
# Valid: type compatibility
 
50
msgid  "abc%d"
 
51
msgstr "xyz%x"
 
52
# Valid: type compatibility
 
53
msgid  "abc%d"
 
54
msgstr "xyz%X"
 
55
# Valid: type compatibility
 
56
msgid  "abc%d"
 
57
msgstr "xyz%o"
 
58
# Valid: type compatibility
 
59
msgid  "abc%x"
 
60
msgstr "xyz%X"
 
61
# Valid: type compatibility
 
62
msgid  "abc%x"
 
63
msgstr "xyz%o"
 
64
# Valid: type compatibility
 
65
msgid  "abc%X"
 
66
msgstr "xyz%o"
 
67
# Invalid: type incompatibility
 
68
msgid  "abc%c"
 
69
msgstr "xyz%d"
 
70
# Invalid: type incompatibility
 
71
msgid  "abc%c"
 
72
msgstr "xyz%x"
 
73
# Invalid: type incompatibility
 
74
msgid  "abc%c"
 
75
msgstr "xyz%X"
 
76
# Invalid: type incompatibility
 
77
msgid  "abc%c"
 
78
msgstr "xyz%o"
 
79
# Invalid: type incompatibility
 
80
msgid  "abc%c"
 
81
msgstr "xyz%s"
 
82
# Invalid: type incompatibility
 
83
msgid  "abc%c"
 
84
msgstr "xyz%S"
 
85
# Invalid: type incompatibility
 
86
msgid  "abc%d"
 
87
msgstr "xyz%s"
 
88
# Invalid: type incompatibility
 
89
msgid  "abc%d"
 
90
msgstr "xyz%S"
 
91
# Invalid: type incompatibility
 
92
msgid  "abc%x"
 
93
msgstr "xyz%s"
 
94
# Invalid: type incompatibility
 
95
msgid  "abc%x"
 
96
msgstr "xyz%S"
 
97
# Invalid: type incompatibility
 
98
msgid  "abc%X"
 
99
msgstr "xyz%s"
 
100
# Invalid: type incompatibility
 
101
msgid  "abc%X"
 
102
msgstr "xyz%S"
 
103
# Invalid: type incompatibility
 
104
msgid  "abc%o"
 
105
msgstr "xyz%s"
 
106
# Invalid: type incompatibility
 
107
msgid  "abc%o"
 
108
msgstr "xyz%S"
 
109
# Invalid: type incompatibility
 
110
msgid  "abc%s"
 
111
msgstr "xyz%S"
 
112
EOF
 
113
 
 
114
: ${MSGFMT=msgfmt}
 
115
n=0
 
116
while read comment; do
 
117
  read msgid_line
 
118
  read msgstr_line
 
119
  n=`expr $n + 1`
 
120
  tmpfiles="$tmpfiles f-lr-2-$n.po f-lr-2-$n.mo"
 
121
  cat <<EOF > f-lr-2-$n.po
 
122
#, librep-format
 
123
${msgid_line}
 
124
${msgstr_line}
 
125
EOF
 
126
  fail=
 
127
  if echo "$comment" | grep 'Valid:' > /dev/null; then
 
128
    if ${MSGFMT} --check-format -o f-lr-2-$n.mo f-lr-2-$n.po; then
 
129
      :
 
130
    else
 
131
      fail=yes
 
132
    fi
 
133
  else
 
134
    ${MSGFMT} --check-format -o f-lr-2-$n.mo f-lr-2-$n.po 2> /dev/null
 
135
    if test $? = 1; then
 
136
      :
 
137
    else
 
138
      fail=yes
 
139
    fi
 
140
  fi
 
141
  if test -n "$fail"; then
 
142
    echo "Format string checking error:" 1>&2
 
143
    cat f-lr-2-$n.po 1>&2
 
144
    exit 1
 
145
  fi
 
146
  rm -f f-lr-2-$n.po f-lr-2-$n.mo
 
147
done < f-lr-2.data
 
148
 
 
149
rm -fr $tmpfiles
 
150
 
 
151
exit 0