3 # More tests for C# support: string syntax
6 trap 'rm -fr $tmpfiles' 1 2 3 15
8 tmpfiles
="$tmpfiles xg-cs-3.cs"
9 tr '%' '\015' <<\EOF
> xg-cs-3.cs
11 public static void Main
(String
[] args
) {
12 // Test recognition of \u escapes.
13 GetString
("B\u00f6se B\u00fcbchen");
14 // \u escapes with
more than one u are invalid.
15 GetString
("Japanese: \uu65e5\uuu672c\u8A9e");
16 GetString
("embedded\nnewline");
17 // Spaces from end of comment are removed.
%GetString
("dummy");
18 // Two backslashes
(unlike
in Java
, where this is just one backslash
).
19 GetString
("\u005c\u005c");
20 // A
6-character string
(unlike
in Java
, where this is just one backslash
).
21 GetString
("\\u005c");
22 // A single backslash.
24 // There is only one \u recognition pass.
25 GetString
("\u005cu005c");
26 // Octal escape sequences are not recognized
, except
for \
0.
28 // Escape sequences
in strings.
29 GetString
("t -> \t, b -> \b, n -> \n, dquote -> \", squote -> \' ...");
30 // Hex escapes are recognized.
31 GetString
("bel: \x07\n");
32 GetString
// Recognized despite comments
33 ( /* Even across multiline
34 comment
! */ "this is a single " /* now comes the concatenation
! */ + // after
+
36 // Verbatim string literals are extracted.
37 GetString
(@
"verbatim 1");
38 // In verbatim string literals
, no escape sequences are recognized.
39 GetString
(@
"verbatim 2 \u005c \\ \t \b \n \'");
40 // In verbatim string literals
, only doubled delimiters are recognized.
41 GetString
(@
"verbatim 3 ""test");
42 // Normal and verbatim string literals can be concatenated.
43 GetString
("left - \"quot" + @
"ation"" - right");
44 // Character literals are not extracted.
46 // Invalid concatenations are not concatenated.
47 GetString
("fooba"+'r');
48 // Verify that a comma inside braces is hidden.
49 MyGetString
(new Object
[] { "don't", "fool", "me" }, "this is the second argument");
54 tmpfiles
="$tmpfiles xg-cs-3.po"
55 : ${XGETTEXT=xgettext}
56 # delete POT-Creation-Date: line because the date depends on local time.
57 ${XGETTEXT} --output - --add-location -c -kMyGetString:2 xg-cs-3.cs
2>/dev
/null \
58 |
sed '/\"POT-Creation-Date:.*/d' > xg-cs-3.po
59 test $?
= 0 ||
{ rm -fr $tmpfiles; exit 1; }
61 tmpfiles
="$tmpfiles xg-cs-3.ok"
62 cat <<\EOF
> xg-cs-3.ok
63 # SOME DESCRIPTIVE TITLE.
64 # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
65 # This file is distributed under the same license as the PACKAGE package.
66 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
71 "Project-Id-Version: PACKAGE VERSION\n"
72 "Report-Msgid-Bugs-To: \n"
73 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
74 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
75 "Language-Team: LANGUAGE <LL@li.org>\n"
77 "Content-Type: text/plain; charset=UTF-8\n"
78 "Content-Transfer-Encoding: 8bit\n"
80 #. Test recognition of \u escapes.
85 #. \u escapes with more than one u are invalid.
87 msgid
"Japanese: \\uu65e5\\uuu672c語"
96 #. Spaces from end of comment are removed.
101 #. Two backslashes (unlike in Java, where this is just one backslash).
106 #. A 6-character string (unlike in Java, where this is just one backslash).
107 #. There is only one \u recognition pass.
108 #: xg-cs-3.cs:12 xg-cs-3.cs:16
112 #. A single backslash.
117 #. Octal escape sequences are not recognized, except for \0.
122 #. Escape sequences in strings.
125 "t -> \t, b -> \b, n -> \n"
126 ", dquote -> \", squote -> ' ..."
129 #. Hex escapes are recognized.
134 #. Recognized despite comments
135 #. Even across multiline
138 msgid
"this is a single long line"
141 #. Verbatim string literals are extracted.
146 #. In verbatim string literals, no escape sequences are recognized.
148 msgid
"verbatim 2 \\u005c \\\\ \\t \\b \\n \\'"
151 #. In verbatim string literals, only doubled delimiters are recognized.
153 msgid
"verbatim 3 \"test"
156 #. Normal and verbatim string literals can be concatenated.
158 msgid
"left - \"quotation\" - right"
161 #. Invalid concatenations are not concatenated.
166 #. Verify that a comma inside braces is hidden.
168 msgid
"this is the second argument"
173 ${DIFF} xg-cs-3.ok xg-cs-3.po