summaryrefslogtreecommitdiffstats
path: root/gettext-tools/tests/xgettext-csharp-3
blob: 30d9a9b3e09b97e55b4c7148f5326d19216b28a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
#!/bin/sh
. "${srcdir=.}/init.sh"; path_prepend_ . ../src

# More tests for C# support: string syntax

LC_ALL=C tr '%' '\015' <<\EOF > xg-cs-3.cs
class TestCase {
  public static void Main (String[] args) {
    // Test recognition of \u escapes.
    GetString ("B\u00f6se B\u00fcbchen");
    // \u escapes with more than one u are invalid.
    GetString ("Japanese: \uu65e5\uuu672c\u8A9e");
    GetString ("embedded\nnewline");
    // Spaces from end of comment are removed.    %GetString("dummy");
    // Two backslashes (unlike in Java, where this is just one backslash).
    GetString ("\u005c\u005c");
    // A 6-character string (unlike in Java, where this is just one backslash).
    GetString ("\\u005c");
    // A single backslash.
    GetString ("\\");
    // There is only one \u recognition pass.
    GetString ("\u005cu005c");
    // Octal escape sequences are not recognized, except for \0.
    GetString ("\134");
    // Escape sequences in strings.
    GetString ("t -> \t, b -> \b, n -> \n, dquote -> \", squote -> \' ...");
    // Hex escapes are recognized.
    GetString ("bel: \x07\n");
    GetString // Recognized despite comments
       ( /* Even across multiline
comment! */ "this is a single " /* now comes the concatenation! */ + // after +
         "long line");
    // Verbatim string literals are extracted.
    GetString (@"verbatim 1");
    // In verbatim string literals, no escape sequences are recognized.
    GetString (@"verbatim 2 \u005c \\ \t \b \n \'");
    // In verbatim string literals, only doubled delimiters are recognized.
    GetString (@"verbatim 3 ""test");
    // Normal and verbatim string literals can be concatenated.
    GetString ("left - \"quot" + @"ation"" - right");
    // Character literals are not extracted.
    GetString ('x');
    // Invalid concatenations are not concatenated.
    GetString ("fooba"+'r');
    // Verify that a comma inside braces is hidden.
    MyGetString (new Object[] { "don't", "fool", "me" }, "this is the second argument");
  }
}
EOF

: ${XGETTEXT=xgettext}
# delete POT-Creation-Date: line because the date depends on local time.
${XGETTEXT} --output - --add-location -c -kMyGetString:2 xg-cs-3.cs 2>/dev/null \
  | sed '/\"POT-Creation-Date:.*/d' | LC_ALL=C tr -d '\r' > xg-cs-3.po || exit 1

cat <<\EOF > xg-cs-3.ok
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

#. Test recognition of \u escapes.
#: xg-cs-3.cs:4
msgid "Böse Bübchen"
msgstr ""

#. \u escapes with more than one u are invalid.
#: xg-cs-3.cs:6
msgid "Japanese: \\uu65e5\\uuu672c語"
msgstr ""

#: xg-cs-3.cs:7
msgid ""
"embedded\n"
"newline"
msgstr ""

#. Spaces from end of comment are removed.
#: xg-cs-3.cs:8
msgid "dummy"
msgstr ""

#. Two backslashes (unlike in Java, where this is just one backslash).
#: xg-cs-3.cs:10
msgid "\\\\"
msgstr ""

#. A 6-character string (unlike in Java, where this is just one backslash).
#. There is only one \u recognition pass.
#: xg-cs-3.cs:12 xg-cs-3.cs:16
msgid "\\u005c"
msgstr ""

#. A single backslash.
#: xg-cs-3.cs:14
msgid "\\"
msgstr ""

#. Octal escape sequences are not recognized, except for \0.
#: xg-cs-3.cs:18
msgid "\\134"
msgstr ""

#. Escape sequences in strings.
#: xg-cs-3.cs:20
msgid ""
"t -> \t, b -> \b, n -> \n"
", dquote -> \", squote -> ' ..."
msgstr ""

#. Hex escapes are recognized.
#: xg-cs-3.cs:22
msgid "bel: \a\n"
msgstr ""

#. Recognized despite comments
#. Even across multiline
#. comment!
#: xg-cs-3.cs:25
msgid "this is a single long line"
msgstr ""

#. Verbatim string literals are extracted.
#: xg-cs-3.cs:28
msgid "verbatim 1"
msgstr ""

#. In verbatim string literals, no escape sequences are recognized.
#: xg-cs-3.cs:30
msgid "verbatim 2 \\u005c \\\\ \\t \\b \\n \\'"
msgstr ""

#. In verbatim string literals, only doubled delimiters are recognized.
#: xg-cs-3.cs:32
msgid "verbatim 3 \"test"
msgstr ""

#. Normal and verbatim string literals can be concatenated.
#: xg-cs-3.cs:34
msgid "left - \"quotation\" - right"
msgstr ""

#. Invalid concatenations are not concatenated.
#: xg-cs-3.cs:38
msgid "fooba"
msgstr ""

#. Verify that a comma inside braces is hidden.
#: xg-cs-3.cs:40
msgid "this is the second argument"
msgstr ""
EOF

: ${DIFF=diff}
${DIFF} xg-cs-3.ok xg-cs-3.po
result=$?

exit $result