]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Test plural formula dependent checking of format strings.
authorBruno Haible <bruno@clisp.org>
Mon, 17 Oct 2005 10:20:39 +0000 (10:20 +0000)
committerBruno Haible <bruno@clisp.org>
Tue, 23 Jun 2009 10:12:54 +0000 (12:12 +0200)
gettext-tools/tests/msgfmt-15 [new file with mode: 0755]

diff --git a/gettext-tools/tests/msgfmt-15 b/gettext-tools/tests/msgfmt-15
new file mode 100755 (executable)
index 0000000..7ebb1ad
--- /dev/null
@@ -0,0 +1,137 @@
+#! /bin/sh
+
+# Test plural formula dependent checking of format strings.
+
+tmpfiles=""
+trap 'rm -fr $tmpfiles' 1 2 3 15
+
+# Take as example a plural formula which takes the values 0 and 2 infinitely
+# often, and value 1 only a few times.
+# Test: 1 - have %d everywhere - OK
+#       2 - lack %d for value 0 - error
+#       3 - lack %d for value 1 - OK
+#       4 - lack %d for value 2 - error
+
+tmpfiles="$tmpfiles mf-15.po1"
+cat <<\EOF > mf-15.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=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=3; plural=(n <= 1 ? 1 : (n % 2) == 0 ? 2 : 0);\n"
+
+#: src/reduce.c:511
+#, c-format
+msgid "%d useless nonterminal"
+msgid_plural "%d useless nonterminals"
+msgstr[0] "%d unnütze Nichtterminale"
+msgstr[1] "%d unnützes Nichtterminal"
+msgstr[2] "%d der unnützen Nichtterminale"
+EOF
+
+: ${MSGFMT=msgfmt}
+${MSGFMT} --check mf-15.po1 -o /dev/null
+test $? = 0 || { rm -fr $tmpfiles; exit 1; }
+
+tmpfiles="$tmpfiles mf-15.po2"
+cat <<\EOF > mf-15.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=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=3; plural=(n <= 1 ? 1 : (n % 2) == 0 ? 2 : 0);\n"
+
+#: src/reduce.c:511
+#, c-format
+msgid "%d useless nonterminal"
+msgid_plural "%d useless nonterminals"
+msgstr[0] "unnütze Nichtterminale"
+msgstr[1] "%d unnützes Nichtterminal"
+msgstr[2] "%d der unnützen Nichtterminale"
+EOF
+
+: ${MSGFMT=msgfmt}
+${MSGFMT} --check mf-15.po2 -o /dev/null 2>/dev/null
+test $? = 1 || { rm -fr $tmpfiles; exit 1; }
+
+tmpfiles="$tmpfiles mf-15.po3"
+cat <<\EOF > mf-15.po3
+# 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=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=3; plural=(n <= 1 ? 1 : (n % 2) == 0 ? 2 : 0);\n"
+
+#: src/reduce.c:511
+#, c-format
+msgid "%d useless nonterminal"
+msgid_plural "%d useless nonterminals"
+msgstr[0] "%d unnütze Nichtterminale"
+msgstr[1] "unnützes Nichtterminal"
+msgstr[2] "%d der unnützen Nichtterminale"
+EOF
+
+: ${MSGFMT=msgfmt}
+${MSGFMT} --check mf-15.po3 -o /dev/null
+test $? = 0 || { rm -fr $tmpfiles; exit 1; }
+
+tmpfiles="$tmpfiles mf-15.po4"
+cat <<\EOF > mf-15.po4
+# 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=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=3; plural=(n <= 1 ? 1 : (n % 2) == 0 ? 2 : 0);\n"
+
+#: src/reduce.c:511
+#, c-format
+msgid "%d useless nonterminal"
+msgid_plural "%d useless nonterminals"
+msgstr[0] "%d unnütze Nichtterminale"
+msgstr[1] "%d unnützes Nichtterminal"
+msgstr[2] "der unnützen Nichtterminale"
+EOF
+
+: ${MSGFMT=msgfmt}
+${MSGFMT} --check mf-15.po4 -o /dev/null 2>/dev/null
+test $? = 1 || { rm -fr $tmpfiles; exit 1; }
+
+rm -fr $tmpfiles
+
+exit $result