]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Test the msgunfmt --csharp option.
authorBruno Haible <bruno@clisp.org>
Thu, 8 Jan 2004 11:49:21 +0000 (11:49 +0000)
committerBruno Haible <bruno@clisp.org>
Tue, 23 Jun 2009 10:11:35 +0000 (12:11 +0200)
gettext-tools/tests/msgunfmt-csharp-1 [new file with mode: 0755]

diff --git a/gettext-tools/tests/msgunfmt-csharp-1 b/gettext-tools/tests/msgunfmt-csharp-1
new file mode 100755 (executable)
index 0000000..6829596
--- /dev/null
@@ -0,0 +1,72 @@
+#! /bin/sh
+
+# Test of --csharp option.
+
+tmpfiles=""
+trap 'rm -fr $tmpfiles' 1 2 3 15
+
+# Test whether we can compile and execute C# programs.
+test "${TESTCSHARP}" = yes || 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.
+#, csharp-format
+msgid "a piece of cake"
+msgid_plural "{0} pieces of cake"
+msgstr[0] "un morceau de gateau"
+msgstr[1] "{0} morceaux de gateau"
+
+# Reverse the arguments.
+#, csharp-format
+msgid "{0} is replaced by {1}."
+msgstr "{1} remplace {0}."
+EOF
+
+tmpfiles="$tmpfiles fr/prog.resources.dll"
+: ${MSGFMT=msgfmt}
+GETTEXTCSHARPLIBDIR=../../gettext-runtime/intl-csharp \
+${MSGFMT} --csharp -d . -r prog -l fr fr.po || exit 1
+
+tmpfiles="$tmpfiles prog.out"
+: ${MSGUNFMT=msgunfmt}
+GETTEXTCSHARPEXEDIR=../src \
+GETTEXTCSHARPLIBDIR=../../gettext-runtime/intl-csharp \
+${MSGUNFMT} --csharp -d . -r prog -l fr -o prog.out || exit 1
+
+tmpfiles="$tmpfiles prog.sort"
+: ${MSGCAT=msgcat}
+${MSGCAT} -s prog.out -o prog.sort || 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 "'Your command, please?', asked the waiter."
+msgstr "«Votre commande, s'il vous plait», dit le garçon."
+
+msgid "a piece of cake"
+msgid_plural "{0} pieces of cake"
+msgstr[0] "un morceau de gateau"
+msgstr[1] "{0} morceaux de gateau"
+
+msgid "{0} is replaced by {1}."
+msgstr "{1} remplace {0}."
+EOF
+: ${DIFF=diff}
+${DIFF} prog.ok prog.sort || exit 1
+
+rm -fr $tmpfiles
+
+exit 0