• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /netgear-WNDR4500-V1.0.1.40_1.0.68/ap/gpl/timemachine/gettext-0.17/gettext-tools/tests/
1#! /bin/sh
2
3# Test recognition of Object Pascal format strings.
4
5tmpfiles=""
6trap 'rm -fr $tmpfiles' 1 2 3 15
7
8tmpfiles="$tmpfiles f-op-1.data"
9cat <<\EOF > f-op-1.data
10# Valid: no argument
11"abc%%"
12# Valid: one string argument
13"abc%s"
14# Valid: one integer argument
15"abc%d"
16# Valid: one integer argument
17"abc%X"
18# Valid: one floating-point argument
19"abc%e"
20# Valid: one floating-point argument
21"abc%f"
22# Valid: one floating-point argument
23"abc%g"
24# Valid: one floating-point argument
25"abc%n"
26# Valid: one floating-point argument
27"abc%m"
28# Valid: one pointer argument
29"abc%p"
30# Valid: one argument with flags
31"abc%-g"
32# Valid: one argument with width
33"abc%2g"
34# Valid: one argument with width
35"abc%*g"
36# Valid: one argument with precision
37"abc%.4g"
38# Valid: one argument with precision
39"abc%.*g"
40# Valid: one argument with width and precision
41"abc%14.4g"
42# Valid: one argument with width and precision
43"abc%14.*g"
44# Valid: one argument with width and precision
45"abc%*.4g"
46# Valid: one argument with width and precision
47"abc%*.*g"
48# Invalid: unterminated
49"abc%"
50# Invalid: unknown format specifier
51"abc%y"
52# Invalid: flags after width
53"abc%*-g"
54# Invalid: twice precision
55"abc%.4.2g"
56# Valid: three arguments
57"abc%d%x%x"
58# Valid: a numbered argument
59"abc%0:d"
60# Valid: two-digit numbered arguments
61"abc%10:def%9:dgh%8:dij%7:dkl%6:dmn%5:dop%4:dqr%3:dst%2:duv%1:dwx%0:dyz"
62# Invalid: unterminated number
63"abc%1"
64# Invalid: flags before number
65"abc%-0:d"
66# Valid: three arguments, two with same number
67"abc%0:4e,%1:p,%0:g"
68# Invalid: argument with conflicting types
69"abc%0:4x,%1:p,%0:s"
70# Invalid: argument with conflicting types
71"abc%0:4e,%1:p,%0:d"
72# Valid: argument with different but not conflicting types
73"abc%0:4x,%1:p,%0:d"
74# Valid: mixing of numbered and unnumbered arguments
75"abc%d%1:x"
76# Valid: numbered argument with constant precision
77"abc%0:.9x"
78# Valid: mixing of numbered and unnumbered arguments
79"abc%3:.*x"
80# Valid: missing non-final argument
81"abc%1:x%3:s"
82# Valid: permutation
83"abc%1:ddef%0:d"
84# Valid: multiple uses of same argument
85"abc%2:xdef%1:pghi%2:x"
86# Valid: one argument with width
87"abc%1:*g"
88# Valid: one argument with width and precision
89"abc%2:*.*g"
90EOF
91
92: ${XGETTEXT=xgettext}
93n=0
94while read comment; do
95  read string
96  n=`expr $n + 1`
97  tmpfiles="$tmpfiles f-op-1-$n.in f-op-1-$n.po"
98  echo "x.y=${string}" | sed -e "s/\"/'/g" > f-op-1-$n.in
99  ${XGETTEXT} -L RST -o f-op-1-$n.po f-op-1-$n.in || exit 1
100  test -f f-op-1-$n.po || exit 1
101  fail=
102  if echo "$comment" | grep 'Valid:' > /dev/null; then
103    if grep object-pascal-format f-op-1-$n.po > /dev/null; then
104      :
105    else
106      fail=yes
107    fi
108  else
109    if grep object-pascal-format f-op-1-$n.po > /dev/null; then
110      fail=yes
111    else
112      :
113    fi
114  fi
115  if test -n "$fail"; then
116    echo "Format string recognition error:" 1>&2
117    cat f-op-1-$n.in 1>&2
118    echo "Got:" 1>&2
119    cat f-op-1-$n.po 1>&2
120    exit 1
121  fi
122  rm -f f-op-1-$n.in f-op-1-$n.po
123done < f-op-1.data
124
125rm -fr $tmpfiles
126
127exit 0
128