From: Bruno Haible Date: Mon, 11 Mar 2002 12:21:28 +0000 (+0000) Subject: Tests for msgfmt --java and --tcl modes. X-Git-Tag: v0.11.1~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e0c6a619fdedc531b0fbb9e991094d80b598b765;p=thirdparty%2Fgettext.git Tests for msgfmt --java and --tcl modes. --- diff --git a/tests/ChangeLog b/tests/ChangeLog index a9b91b2e0..f456f251a 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,9 @@ +2002-03-10 Bruno Haible + + * msgunfmt-2: New file. + * msgunfmt-3: New file. + * Makefile.am (TESTS): Add them. + 2002-03-07 Bruno Haible * lang-gawk: Fix the version recognition, to work with gawk 2.xx. diff --git a/tests/Makefile.am b/tests/Makefile.am index 577a4a2f2..c857ddd56 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -40,7 +40,7 @@ TESTS = gettext-1 gettext-2 \ msgmerge-7 msgmerge-8 msgmerge-9 msgmerge-10 msgmerge-11 msgmerge-12 \ msgmerge-13 msgmerge-14 msgmerge-15 msgmerge-16 msgmerge-17 \ msgmerge-18 msgmerge-19 msgmerge-20 \ - msgunfmt-1 \ + msgunfmt-1 msgunfmt-2 msgunfmt-3 \ msguniq-1 msguniq-2 msguniq-3 \ xgettext-1 xgettext-2 xgettext-3 xgettext-4 xgettext-5 xgettext-6 \ xgettext-7 xgettext-8 xgettext-9 xgettext-10 xgettext-11 xgettext-12 \ diff --git a/tests/msgunfmt-2 b/tests/msgunfmt-2 new file mode 100755 index 000000000..7cccbad6a --- /dev/null +++ b/tests/msgunfmt-2 @@ -0,0 +1,66 @@ +#! /bin/sh + +# Test of --java option. + +tmpfiles="" +trap 'rm -fr $tmpfiles' 1 2 3 15 + +# Test whether we can compile and execute Java programs. +test "${TESTJAVA}" = yes || { echo "SKIP: msgunfmt-2"; exit 77; } + +tmpfiles="$tmpfiles fr.po" +cat <<\EOF > fr.po +msgid "" +msgstr "" +"Content-Type: text/plain; charset=ISO-8859-1\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" + +msgid "'Your command, please?', asked the waiter." +msgstr "«Votre commande, s'il vous plait», dit le garçon." + +# Les gateaux allemands sont les meilleurs du monde. +#, java-format +msgid "a piece of cake" +msgid_plural "{0,number} pieces of cake" +msgstr[0] "un morceau de gateau" +msgstr[1] "{0,number} morceaux de gateau" + +# Reverse the arguments. +#, java-format +msgid "{0} is replaced by {1}." +msgstr "{1} remplace {0}." +EOF + +tmpfiles="$tmpfiles prog_fr.class" +: ${MSGFMT=msgfmt} +${MSGFMT} -j -d . -r prog -l fr fr.po || exit 1 + +tmpfiles="$tmpfiles prog.out" +: ${MSGUNFMT=msgunfmt} +GETTEXTJAR=../src/gettext.jar \ +${MSGUNFMT} --java -d . -r prog -l fr -o prog.out || exit 1 + +tmpfiles="$tmpfiles prog.ok" +cat <<\EOF > prog.ok +msgid "" +msgstr "" +"Content-Type: text/plain; charset=UTF-8\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" + +msgid "a piece of cake" +msgid_plural "{0,number} pieces of cake" +msgstr[0] "un morceau de gateau" +msgstr[1] "{0,number} morceaux de gateau" + +msgid "'Your command, please?', asked the waiter." +msgstr "«Votre commande, s'il vous plait», dit le garçon." + +msgid "{0} is replaced by {1}." +msgstr "{1} remplace {0}." +EOF +: ${DIFF=diff} +${DIFF} prog.ok prog.out || exit 1 + +rm -fr $tmpfiles + +exit 0 diff --git a/tests/msgunfmt-3 b/tests/msgunfmt-3 new file mode 100755 index 000000000..18aa83af1 --- /dev/null +++ b/tests/msgunfmt-3 @@ -0,0 +1,59 @@ +#! /bin/sh + +# Test of --tcl option. + +tmpfiles="" +trap 'rm -fr $tmpfiles' 1 2 3 15 + +# Test whether we can execute Tcl programs. +tmpfiles="$tmpfiles version.tcl" +cat <<\EOF > version.tcl +puts $tcl_version +EOF +(tclsh version.tcl) >/dev/null 2>/dev/null \ + || { echo "SKIP: msgunfmt-3"; rm -fr $tmpfiles; exit 77; } + +tmpfiles="$tmpfiles fr.po" +cat <<\EOF > fr.po +msgid "" +msgstr "Content-Type: text/plain; charset=ISO-8859-1\n" + +#: program.tcl:5 +msgid "'Your command, please?', asked the waiter." +msgstr "«Votre commande, s'il vous plait», dit le garçon." + +# Reverse the arguments. +#: program.tcl:6 +#, tcl-format +msgid "%s is replaced by %s." +msgstr "%2$s remplace %1$s." +EOF + +tmpfiles="$tmpfiles msgs" +test -d msgs || mkdir msgs + +: ${MSGFMT=msgfmt} +${MSGFMT} --tcl -d msgs -l fr fr.po || exit 1 + +tmpfiles="$tmpfiles prog.out" +: ${MSGUNFMT=msgunfmt} +GETTEXTDATADIR=../src \ +${MSGUNFMT} --tcl -d msgs -l fr -o prog.out || exit 1 + +tmpfiles="$tmpfiles prog.ok" +cat <<\EOF > prog.ok +msgid "" +msgstr "Content-Type: text/plain; charset=UTF-8\n" + +msgid "'Your command, please?', asked the waiter." +msgstr "«Votre commande, s'il vous plait», dit le garçon." + +msgid "%s is replaced by %s." +msgstr "%2$s remplace %1$s." +EOF +: ${DIFF=diff} +${DIFF} prog.ok prog.out || exit 1 + +rm -fr $tmpfiles + +exit 0