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