--- /dev/null
+#! /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