1#!/bin/sh
2
3# Some tests for C# support
4
5tmpfiles=""
6trap 'rm -fr $tmpfiles' 1 2 3 15
7
8tmpfiles="$tmpfiles xg-cs-1.cs"
9cat <<EOF > xg-cs-1.cs
10using GNU.Gettext;
11class TestCase {
12  public TestCase() {
13    GettextResourceManager rm = new GettextResourceManager("test");
14    // standard usage
15    String test1 = rm.GetString("Test String 1");
16    /* C style comment */
17    String test2 = rm.GetString("Test String 2");
18    // C# "multiline" string
19    String test3 = rm.GetString("Test " +
20    "String " +
21    "3");
22    // empty string
23    String test4 = rm.GetString("");
24#if false
25    // commented out through #if
26    String test5 = rm.GetString("Test String 5");
27#endif
28  }
29}
30EOF
31
32tmpfiles="$tmpfiles xg-cs-1.po"
33: ${XGETTEXT=xgettext}
34${XGETTEXT} --omit-header --no-location -c -d xg-cs-1 xg-cs-1.cs
35test $? = 0 || { rm -fr $tmpfiles; exit 1; }
36
37tmpfiles="$tmpfiles xg-cs-1.ok"
38cat <<EOF > xg-cs-1.ok
39#. standard usage
40msgid "Test String 1"
41msgstr ""
42
43#. C style comment
44msgid "Test String 2"
45msgstr ""
46
47#. C# "multiline" string
48msgid "Test String 3"
49msgstr ""
50
51#. empty string
52msgid ""
53msgstr ""
54
55#. commented out through #if
56msgid "Test String 5"
57msgstr ""
58EOF
59
60: ${DIFF=diff}
61${DIFF} xg-cs-1.ok xg-cs-1.po
62result=$?
63
64rm -fr $tmpfiles
65
66exit $result
67