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.tmp.po xg-cs-1.po"
33: ${XGETTEXT=xgettext}
34${XGETTEXT} --omit-header --no-location -c -d xg-cs-1.tmp xg-cs-1.cs
35test $? = 0 || { rm -fr $tmpfiles; exit 1; }
36tr -d '\r' < xg-cs-1.tmp.po > xg-cs-1.po
37test $? = 0 || { rm -fr $tmpfiles; exit 1; }
38
39tmpfiles="$tmpfiles xg-cs-1.ok"
40cat <<EOF > xg-cs-1.ok
41#. standard usage
42msgid "Test String 1"
43msgstr ""
44
45#. C style comment
46msgid "Test String 2"
47msgstr ""
48
49#. C# "multiline" string
50msgid "Test String 3"
51msgstr ""
52
53#. empty string
54msgid ""
55msgstr ""
56
57#. commented out through #if
58msgid "Test String 5"
59msgstr ""
60EOF
61
62: ${DIFF=diff}
63${DIFF} xg-cs-1.ok xg-cs-1.po
64result=$?
65
66rm -fr $tmpfiles
67
68exit $result
69