67 lines
1.2 KiB
Bash
67 lines
1.2 KiB
Bash
#!/bin/sh
|
|
|
|
# Some tests for C# support
|
|
|
|
tmpfiles=""
|
|
trap 'rm -fr $tmpfiles' 1 2 3 15
|
|
|
|
tmpfiles="$tmpfiles xg-cs-1.cs"
|
|
cat <<EOF > xg-cs-1.cs
|
|
using GNU.Gettext;
|
|
class TestCase {
|
|
public TestCase() {
|
|
GettextResourceManager rm = new GettextResourceManager("test");
|
|
// standard usage
|
|
String test1 = rm.GetString("Test String 1");
|
|
/* C style comment */
|
|
String test2 = rm.GetString("Test String 2");
|
|
// C# "multiline" string
|
|
String test3 = rm.GetString("Test " +
|
|
"String " +
|
|
"3");
|
|
// empty string
|
|
String test4 = rm.GetString("");
|
|
#if false
|
|
// commented out through #if
|
|
String test5 = rm.GetString("Test String 5");
|
|
#endif
|
|
}
|
|
}
|
|
EOF
|
|
|
|
tmpfiles="$tmpfiles xg-cs-1.po"
|
|
: ${XGETTEXT=xgettext}
|
|
${XGETTEXT} --omit-header --no-location -c -d xg-cs-1 xg-cs-1.cs
|
|
test $? = 0 || { rm -fr $tmpfiles; exit 1; }
|
|
|
|
tmpfiles="$tmpfiles xg-cs-1.ok"
|
|
cat <<EOF > xg-cs-1.ok
|
|
#. standard usage
|
|
msgid "Test String 1"
|
|
msgstr ""
|
|
|
|
#. C style comment
|
|
msgid "Test String 2"
|
|
msgstr ""
|
|
|
|
#. C# "multiline" string
|
|
msgid "Test String 3"
|
|
msgstr ""
|
|
|
|
#. empty string
|
|
msgid ""
|
|
msgstr ""
|
|
|
|
#. commented out through #if
|
|
msgid "Test String 5"
|
|
msgstr ""
|
|
EOF
|
|
|
|
: ${DIFF=diff}
|
|
${DIFF} xg-cs-1.ok xg-cs-1.po
|
|
result=$?
|
|
|
|
rm -fr $tmpfiles
|
|
|
|
exit $result
|