summaryrefslogtreecommitdiff
path: root/gettext-tools/tests/msgunfmt-csharp-1
diff options
context:
space:
mode:
Diffstat (limited to 'gettext-tools/tests/msgunfmt-csharp-1')
-rwxr-xr-xgettext-tools/tests/msgunfmt-csharp-192
1 files changed, 92 insertions, 0 deletions
diff --git a/gettext-tools/tests/msgunfmt-csharp-1 b/gettext-tools/tests/msgunfmt-csharp-1
new file mode 100755
index 0000000..34c1141
--- /dev/null
+++ b/gettext-tools/tests/msgunfmt-csharp-1
@@ -0,0 +1,92 @@
+#! /bin/sh
+. "${srcdir=.}/init.sh"; path_prepend_ . ../src
+
+# Test of --csharp option.
+
+# Test whether we can compile and execute C# programs.
+test "${CSHARP_CHOICE}" != no || {
+ echo "Skipping test: configured with --disable-csharp"
+ exit 77
+}
+test "${BUILDCSHARP}" = yes || {
+ echo "Skipping test: C# compiler not found"
+ exit 77
+}
+test "${TESTCSHARP}" = yes || {
+ echo "Skipping test: C# engine not found"
+ exit 77
+}
+
+test -d mu-cs-1 || mkdir mu-cs-1
+
+cat <<\EOF > mu-cs-1/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}."
+
+# A proximity measure.
+msgid "Close"
+msgstr "Proche"
+
+# A menu entry.
+msgctxt "File"
+msgid "Close"
+msgstr "Fermer"
+EOF
+
+: ${MSGFMT=msgfmt}
+GETTEXTCSHARPLIBDIR=../../../gettext-runtime/intl-csharp \
+${MSGFMT} --csharp -d mu-cs-1 -r prog -l fr mu-cs-1/fr.po || exit 1
+
+: ${MSGUNFMT=msgunfmt}
+GETTEXTCSHARPEXEDIR=../../src \
+GETTEXTCSHARPLIBDIR=../../../gettext-runtime/intl-csharp \
+${MSGUNFMT} --csharp -d mu-cs-1 -r prog -l fr -o mu-cs-1/prog.out || exit 1
+
+: ${MSGCAT=msgcat}
+${MSGCAT} -s -o mu-cs-1/prog.sort mu-cs-1/prog.out || exit 1
+
+cat <<\EOF > mu-cs-1/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 "Close"
+msgstr "Proche"
+
+msgctxt "File"
+msgid "Close"
+msgstr "Fermer"
+
+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} mu-cs-1/prog.ok mu-cs-1/prog.sort || exit 1
+
+exit 0