]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Tests for msgfmt --java and --tcl modes.
authorBruno Haible <bruno@clisp.org>
Mon, 11 Mar 2002 12:21:28 +0000 (12:21 +0000)
committerBruno Haible <bruno@clisp.org>
Tue, 23 Jun 2009 10:07:48 +0000 (12:07 +0200)
tests/ChangeLog
tests/Makefile.am
tests/msgunfmt-2 [new file with mode: 0755]
tests/msgunfmt-3 [new file with mode: 0755]

index a9b91b2e07c06b27173ba17e5af7b2a60dce6ff1..f456f251ae8b5d891bd65a320fbbd44eed28f5d2 100644 (file)
@@ -1,3 +1,9 @@
+2002-03-10  Bruno Haible  <bruno@clisp.org>
+
+       * msgunfmt-2: New file.
+       * msgunfmt-3: New file.
+       * Makefile.am (TESTS): Add them.
+
 2002-03-07  Bruno Haible  <bruno@clisp.org>
 
        * lang-gawk: Fix the version recognition, to work with gawk 2.xx.
index 577a4a2f2d5febe5241ccf96743c72450f9eb03a..c857ddd56934c8b3630da861bb2363def170c0ac 100644 (file)
@@ -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 (executable)
index 0000000..7cccbad
--- /dev/null
@@ -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 (executable)
index 0000000..18aa83a
--- /dev/null
@@ -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