3
# Test checking of librep format strings.
6
trap 'rm -fr $tmpfiles' 1 2 3 15
8
tmpfiles="$tmpfiles f-lr-2.data"
9
cat <<\EOF > f-lr-2.data
10
# Valid: %% doesn't count
13
# Invalid: invalid msgstr
16
# Valid: same arguments
19
# Valid: same arguments, with different widths
22
# Valid: same arguments but in numbered syntax
27
msgstr "xyz%3$c%2$x%1$s"
28
# Invalid: too few arguments
29
msgid "abc%2$xdef%1$s"
31
# Invalid: too few arguments
34
# Invalid: too many arguments
37
# Valid: same numbered arguments, with different widths
39
msgstr "xyz%2$4s%1$5s"
40
# Invalid: missing argument
41
msgid "abc%2$sdef%1$x"
43
# Invalid: missing argument
44
msgid "abc%1$sdef%2$x"
46
# Invalid: added argument
48
msgstr "xyz%1$xvw%2$c"
49
# Valid: type compatibility
52
# Valid: type compatibility
55
# Valid: type compatibility
58
# Valid: type compatibility
61
# Valid: type compatibility
64
# Valid: type compatibility
67
# Invalid: type incompatibility
70
# Invalid: type incompatibility
73
# Invalid: type incompatibility
76
# Invalid: type incompatibility
79
# Invalid: type incompatibility
82
# Invalid: type incompatibility
85
# Invalid: type incompatibility
88
# Invalid: type incompatibility
91
# Invalid: type incompatibility
94
# Invalid: type incompatibility
97
# Invalid: type incompatibility
100
# Invalid: type incompatibility
103
# Invalid: type incompatibility
106
# Invalid: type incompatibility
109
# Invalid: type incompatibility
116
while read comment; do
120
tmpfiles="$tmpfiles f-lr-2-$n.po f-lr-2-$n.mo"
121
cat <<EOF > f-lr-2-$n.po
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
134
${MSGFMT} --check-format -o f-lr-2-$n.mo f-lr-2-$n.po 2> /dev/null
141
if test -n "$fail"; then
142
echo "Format string checking error:" 1>&2
143
cat f-lr-2-$n.po 1>&2
146
rm -f f-lr-2-$n.po f-lr-2-$n.mo