blob: 7b44251f7acaaae2987cbd8567259a01beb03f16 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
#! /bin/sh
. "${srcdir=.}/init.sh"; path_prepend_ . ../src
# Test recognition of Qt plural format strings.
cat <<\EOF > f-qtp-1.data
# Unrecognized: no argument
"abcdef"
# Unrecognized: unterminated
"abcdef%"
# Unrecognized: unterminated
"abcdef%L"
# Valid: one argument
"abc%ndef"
# Valid: unterminated
"abc%ndef%"
# Valid: unterminated
"abc%ndef%L"
# Valid: multiple uses of same argument
"abc%ndef%nghi"
# Valid: an argument with locale-dependency flag
"abc%Lndef"
EOF
: ${XGETTEXT=xgettext}
n=0
while read comment; do
read string
n=`expr $n + 1`
cat <<EOF > f-qtp-1-$n.in
_(${string});
EOF
${XGETTEXT} -L C++ --qt -k_ -o f-qtp-1-$n.po f-qtp-1-$n.in || Exit 1
test -f f-qtp-1-$n.po || Exit 1
fail=
if echo "$comment" | grep 'Valid:' > /dev/null; then
if grep qt-plural-format f-qtp-1-$n.po > /dev/null; then
:
else
fail=yes
fi
else
if grep qt-plural-format f-qtp-1-$n.po > /dev/null; then
fail=yes
else
:
fi
fi
if test -n "$fail"; then
echo "Format string recognition error:" 1>&2
cat f-qtp-1-$n.in 1>&2
echo "Got:" 1>&2
cat f-qtp-1-$n.po 1>&2
Exit 1
fi
rm -f f-qtp-1-$n.in f-qtp-1-$n.po
done < f-qtp-1.data
Exit 0
|