NetBSD/gnu/dist/gettext/gettext-tools/tests/msgfmt-10

88 lines
2.1 KiB
Bash

#! /bin/sh
# Test format string checking in plural entries.
tmpfiles=""
trap 'rm -fr $tmpfiles' 1 2 3 15
tmpfiles="$tmpfiles mf-test10.po1"
cat <<\EOF > mf-test10.po1
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR Free Software Foundation, Inc.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: GNU bison\n"
"PO-Revision-Date: 2001-04-05 19:47+0200\n"
"Last-Translator: ABC DEF <abc@gnu.uucp>\n"
"Language-Team: test <test@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=ISO-8859-9\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: src/reduce.c:511
#, c-format
msgid "%d useless nonterminal"
msgid_plural "%d useless nonterminals"
msgstr[0] "1 yararsýz deðiþken simge"
msgstr[1] "%d yararsýz deðiþken simges"
#: src/reduce.c:520
#, c-format
msgid "one useless rule"
msgid_plural "%d useless rules"
msgstr[0] "%d yararsýz kural"
msgstr[1] "%d yararsýz kurals"
EOF
: ${MSGFMT=msgfmt}
${MSGFMT} --check mf-test10.po1 -o /dev/null
test $? = 0 || { rm -fr $tmpfiles; exit 1; }
tmpfiles="$tmpfiles mf-test10.po2"
cat <<\EOF > mf-test10.po2
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR Free Software Foundation, Inc.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: GNU bison\n"
"PO-Revision-Date: 2001-04-05 19:47+0200\n"
"Last-Translator: ABC DEF <abc@gnu.uucp>\n"
"Language-Team: test <test@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=ISO-8859-9\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: src/reduce.c:520
#, c-format
msgid "one useless rule"
msgid_plural "%d useless rules"
msgstr[0] "%d yararsýz kural"
msgstr[1] "%d yararsýz kural%s"
EOF
tmpfiles="$tmpfiles mf-test10.err"
: ${MSGFMT=msgfmt}
LC_MESSAGES=C LC_ALL= \
${MSGFMT} --check mf-test10.po2 -o /dev/null \
2>&1 | grep -v '^==' > mf-test10.err
tmpfiles="$tmpfiles mf-test10.ok"
cat << EOF > mf-test10.ok
mf-test10.po2:18: number of format specifications in 'msgid' and 'msgstr[1]' does not match
msgfmt: found 1 fatal error
EOF
: ${DIFF=diff}
${DIFF} mf-test10.ok mf-test10.err
result=$?
rm -fr $tmpfiles
exit $result