diff options
author | Bruno Haible <bruno@clisp.org> | 2001-12-17 11:36:35 +0000 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2009-06-21 23:45:11 +0200 |
commit | b9cfd7850827ed5c91015d5acae347451966c917 (patch) | |
tree | a93a217b07fa6fb1be08abf548030f28d366950c /tests | |
parent | 0fa46515afeb056f80eacc9c0a88c4c41a1ccd00 (diff) | |
download | external_gettext-b9cfd7850827ed5c91015d5acae347451966c917.zip external_gettext-b9cfd7850827ed5c91015d5acae347451966c917.tar.gz external_gettext-b9cfd7850827ed5c91015d5acae347451966c917.tar.bz2 |
Enable format string checking also for plural messages.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/ChangeLog | 5 | ||||
-rw-r--r-- | tests/Makefile.am | 2 | ||||
-rwxr-xr-x | tests/msgfmt-10 | 87 |
3 files changed, 93 insertions, 1 deletions
diff --git a/tests/ChangeLog b/tests/ChangeLog index f11dc47..d4bc1e1 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,8 @@ +2001-12-15 Bruno Haible <bruno@clisp.org> + + * msgfmt-10: New file. + * Makefile.am (TESTS): Add it. + 2001-12-11 Bruno Haible <bruno@clisp.org> * lang-c++: Don't use ostream::form, it's a g++ 2.x extension not diff --git a/tests/Makefile.am b/tests/Makefile.am index a80860e..23d2bb4 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -34,7 +34,7 @@ TESTS = gettext-1 gettext-2 \ msgexec-1 msgexec-2 \ msgfilter-1 msgfilter-2 \ msgfmt-1 msgfmt-2 msgfmt-3 msgfmt-4 msgfmt-5 msgfmt-6 msgfmt-7 \ - msgfmt-8 msgfmt-9 \ + msgfmt-8 msgfmt-9 msgfmt-10 \ msggrep-1 msggrep-2 msggrep-3 msggrep-4 \ msgmerge-1 msgmerge-2 msgmerge-3 msgmerge-4 msgmerge-5 msgmerge-6 \ msgmerge-7 msgmerge-8 msgmerge-9 msgmerge-10 msgmerge-11 msgmerge-12 \ diff --git a/tests/msgfmt-10 b/tests/msgfmt-10 new file mode 100755 index 0000000..2945273 --- /dev/null +++ b/tests/msgfmt-10 @@ -0,0 +1,87 @@ +#! /bin/sh + +# Test format string checking in plural entries. + +tmpfiles="" +trap 'rm -fr $tmpfiles' 1 2 3 15 + +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 || \ + { rm -fr $tmpfiles; exit 1; } + +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> 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 |