• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /netgear-WNDR4500v2-V1.0.0.60_1.0.38/ap/gpl/timemachine/gettext-0.17/gettext-tools/tests/
1#! /bin/sh
2
3# Test checking of Boost format strings.
4
5tmpfiles=""
6trap 'rm -fr $tmpfiles' 1 2 3 15
7
8tmpfiles="$tmpfiles f-bo-2.data"
9cat <<\EOF > f-bo-2.data
10# Valid: %% doesn't count
11msgid  "abc%%def"
12msgstr "xyz"
13# Invalid: invalid msgstr
14msgid  "abc%%def"
15msgstr "xyz%"
16# Valid: same arguments
17msgid  "abc%s%gdef"
18msgstr "xyz%s%g"
19# Valid: same arguments, despite different syntax
20msgid  "abc%s%gdef"
21msgstr "xyz%|s|%|g|"
22# Valid: same arguments, with different widths
23msgid  "abc%2sdef"
24msgstr "xyz%3s"
25# Valid: same arguments but in numbered syntax
26msgid  "abc%s%gdef"
27msgstr "xyz%1$s%2$g"
28# Valid: same arguments but in numbered syntax
29msgid  "abc%s%gdef"
30msgstr "xyz%1%%2$g"
31# Valid: permutation
32msgid  "abc%s%g%cdef"
33msgstr "xyz%3$c%2$g%1$s"
34# Invalid: too few arguments
35msgid  "abc%2$udef%1$s"
36msgstr "xyz%1$s"
37# Invalid: too few arguments
38msgid  "abc%sdef%u"
39msgstr "xyz%s"
40# Invalid: too many arguments
41msgid  "abc%udef"
42msgstr "xyz%uvw%c"
43# Valid: same numbered arguments, with different widths
44msgid  "abc%2$5s%1$4s"
45msgstr "xyz%2$4s%1$5s"
46# Invalid: missing argument
47msgid  "abc%2$sdef%1$u"
48msgstr "xyz%1$u"
49# Invalid: missing argument
50msgid  "abc%1$sdef%2$u"
51msgstr "xyz%2$u"
52# Invalid: added argument
53msgid  "abc%1$udef"
54msgstr "xyz%1$uvw%2$c"
55# Valid: type compatibility
56msgid  "abc%i"
57msgstr "xyz%d"
58# Valid: type compatibility
59msgid  "abc%i"
60msgstr "xyz%o"
61# Valid: type compatibility
62msgid  "abc%i"
63msgstr "xyz%u"
64# Valid: type compatibility
65msgid  "abc%i"
66msgstr "xyz%x"
67# Valid: type compatibility
68msgid  "abc%i"
69msgstr "xyz%X"
70# Valid: type compatibility
71msgid  "abc%e"
72msgstr "xyz%E"
73# Valid: type compatibility
74msgid  "abc%e"
75msgstr "xyz%f"
76# Valid: type compatibility
77msgid  "abc%e"
78msgstr "xyz%g"
79# Valid: type compatibility
80msgid  "abc%e"
81msgstr "xyz%G"
82# Invalid: type incompatibility
83msgid  "abc%c"
84msgstr "xyz%s"
85# Invalid: type incompatibility
86msgid  "abc%c"
87msgstr "xyz%i"
88# Invalid: type incompatibility
89msgid  "abc%c"
90msgstr "xyz%e"
91# Invalid: type incompatibility
92msgid  "abc%c"
93msgstr "xyz%p"
94# Invalid: different argument count
95msgid  "abc%c"
96msgstr "xyz%n"
97# Invalid: type incompatibility
98msgid  "abc%s"
99msgstr "xyz%i"
100# Invalid: type incompatibility
101msgid  "abc%s"
102msgstr "xyz%e"
103# Invalid: type incompatibility
104msgid  "abc%s"
105msgstr "xyz%p"
106# Invalid: different argument count
107msgid  "abc%s"
108msgstr "xyz%n"
109# Invalid: type incompatibility
110msgid  "abc%i"
111msgstr "xyz%e"
112# Invalid: type incompatibility
113msgid  "abc%i"
114msgstr "xyz%p"
115# Invalid: different argument count
116msgid  "abc%i"
117msgstr "xyz%n"
118# Invalid: type incompatibility
119msgid  "abc%e"
120msgstr "xyz%p"
121# Invalid: different argument count
122msgid  "abc%e"
123msgstr "xyz%n"
124# Invalid: different argument count
125msgid  "abc%p"
126msgstr "xyz%n"
127# Valid: size is ignored
128msgid  "abc%i"
129msgstr "xyz%hhi"
130# Valid: size is ignored
131msgid  "abc%i"
132msgstr "xyz%hi"
133# Valid: size is ignored
134msgid  "abc%i"
135msgstr "xyz%li"
136# Valid: size is ignored
137msgid  "abc%i"
138msgstr "xyz%lli"
139# Valid: size is ignored
140msgid  "abc%i"
141msgstr "xyz%Li"
142# Valid: size is ignored
143msgid  "abc%hhi"
144msgstr "xyz%hi"
145# Valid: size is ignored
146msgid  "abc%hhi"
147msgstr "xyz%li"
148# Valid: size is ignored
149msgid  "abc%hhi"
150msgstr "xyz%lli"
151# Valid: size is ignored
152msgid  "abc%hhi"
153msgstr "xyz%Li"
154# Valid: size is ignored
155msgid  "abc%hi"
156msgstr "xyz%li"
157# Valid: size is ignored
158msgid  "abc%hi"
159msgstr "xyz%lli"
160# Valid: size is ignored
161msgid  "abc%hi"
162msgstr "xyz%Li"
163# Valid: size is ignored
164msgid  "abc%li"
165msgstr "xyz%lli"
166# Valid: size is ignored
167msgid  "abc%li"
168msgstr "xyz%Li"
169# Invalid: type incompatibility for width
170msgid  "abc%g%*g"
171msgstr "xyz%*g%g"
172EOF
173
174: ${MSGFMT=msgfmt}
175n=0
176while read comment; do
177  read msgid_line
178  read msgstr_line
179  n=`expr $n + 1`
180  tmpfiles="$tmpfiles f-bo-2-$n.po f-bo-2-$n.mo"
181  cat <<EOF > f-bo-2-$n.po
182#, boost-format
183${msgid_line}
184${msgstr_line}
185EOF
186  fail=
187  if echo "$comment" | grep 'Valid:' > /dev/null; then
188    if ${MSGFMT} --check-format -o f-bo-2-$n.mo f-bo-2-$n.po; then
189      :
190    else
191      fail=yes
192    fi
193  else
194    ${MSGFMT} --check-format -o f-bo-2-$n.mo f-bo-2-$n.po 2> /dev/null
195    if test $? = 1; then
196      :
197    else
198      fail=yes
199    fi
200  fi
201  if test -n "$fail"; then
202    echo "Format string checking error:" 1>&2
203    cat f-bo-2-$n.po 1>&2
204    exit 1
205  fi
206  rm -f f-bo-2-$n.po f-bo-2-$n.mo
207done < f-bo-2.data
208
209rm -fr $tmpfiles
210
211exit 0
212