• 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 recognition of KDE format strings.
4
5tmpfiles=""
6trap 'rm -fr $tmpfiles' 1 2 3 15
7
8tmpfiles="$tmpfiles f-kd-1.data"
9cat <<\EOF > f-kd-1.data
10# Unrecognized: no argument
11"abc%%def"
12# Valid: one argument
13"abc%1def"
14# Unrecognized: no argument (digit sequence starting with a zero)
15"abc%09def"
16# Valid: one argument, digit sequence starting with a zero
17"abc%1def%0"
18# Valid: one argument, digit sequence starting with a zero
19"abc%1def%00"
20# Valid: 9 arguments
21"abc%1%2%3%4%9%7%8%5%6def"
22# Valid: 9 arguments, missing one of them
23"abc%1%2%3%4%9%7%5%6def"
24# Invalid: one argument but missing arguments %1 ... %8
25"abc%9def"
26# Valid: more than ten arguments, missing one of them
27"abc%1%2%3%4%9%7%5%6%12%10%11def"
28# Invalid: one argument specified by two digits but missing arguments %1 ... %98
29"abc%99def"
30# Valid: unterminated
31"abc%1def%"
32# Valid: unterminated
33"abc%1def%L"
34# Valid: non-digit
35"abc%1def%x"
36# Valid: permutation
37"abc%2def%1"
38# Valid: multiple uses of same argument
39"abc%2def%1ghi%2"
40# Unrecognized: no argument
41"abc%L1def"
42# Unrecognized: no argument
43"abc%L12def"
44EOF
45
46: ${XGETTEXT=xgettext}
47n=0
48while read comment; do
49  read string
50  n=`expr $n + 1`
51  tmpfiles="$tmpfiles f-kd-1-$n.in f-kd-1-$n.po"
52  cat <<EOF > f-kd-1-$n.in
53_(${string});
54EOF
55  ${XGETTEXT} -L C++ --kde -k_ -o f-kd-1-$n.po f-kd-1-$n.in || exit 1
56  test -f f-kd-1-$n.po || exit 1
57  fail=
58  if echo "$comment" | grep 'Valid:' > /dev/null; then
59    if grep kde-format f-kd-1-$n.po > /dev/null; then
60      :
61    else
62      fail=yes
63    fi
64  else
65    if grep kde-format f-kd-1-$n.po > /dev/null; then
66      fail=yes
67    else
68      :
69    fi
70  fi
71  if test -n "$fail"; then
72    echo "Format string recognition error:" 1>&2
73    cat f-kd-1-$n.in 1>&2
74    echo "Got:" 1>&2
75    cat f-kd-1-$n.po 1>&2
76    exit 1
77  fi
78  rm -f f-kd-1-$n.in f-kd-1-$n.po
79done < f-kd-1.data
80
81rm -fr $tmpfiles
82
83exit 0
84