Imported Upstream version 0.19.7
[platform/upstream/gettext.git] / gettext-tools / tests / xgettext-csharp-1
1 #!/bin/sh
2 . "${srcdir=.}/init.sh"; path_prepend_ . ../src
3
4 # Some tests for C# support
5
6 cat <<EOF > xg-cs-1.cs
7 using GNU.Gettext;
8 class 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
27 second line
28 third line");
29   }
30 }
31 EOF
32
33 : ${XGETTEXT=xgettext}
34 ${XGETTEXT} --omit-header --no-location -c -d xg-cs-1.tmp xg-cs-1.cs || exit 1
35 LC_ALL=C tr -d '\r' < xg-cs-1.tmp.po > xg-cs-1.po || exit 1
36
37 cat <<EOF > xg-cs-1.ok
38 #. standard usage
39 msgid "Test String 1"
40 msgstr ""
41
42 #. C style comment
43 msgid "Test String 2"
44 msgstr ""
45
46 #. C# "multiline" string
47 msgid "Test String 3"
48 msgstr ""
49
50 #. empty string
51 msgid ""
52 msgstr ""
53
54 #. commented out through #if
55 msgid "Test String 5"
56 msgstr ""
57
58 #. verbatim string
59 msgid ""
60 "first line\n"
61 "second line\n"
62 "third line"
63 msgstr ""
64 EOF
65
66 : ${DIFF=diff}
67 ${DIFF} xg-cs-1.ok xg-cs-1.po
68 result=$?
69
70 exit $result