xgettext-csharp-3 revision 1.1 1 1.1 christos #!/bin/sh
2 1.1 christos
3 1.1 christos # More tests for C# support: string syntax
4 1.1 christos
5 1.1 christos tmpfiles=""
6 1.1 christos trap 'rm -fr $tmpfiles' 1 2 3 15
7 1.1 christos
8 1.1 christos tmpfiles="$tmpfiles xg-cs-3.cs"
9 1.1 christos tr '%' '\015' <<\EOF > xg-cs-3.cs
10 1.1 christos class TestCase {
11 1.1 christos public static void Main (String[] args) {
12 1.1 christos // Test recognition of \u escapes.
13 1.1 christos GetString ("B\u00f6se B\u00fcbchen");
14 1.1 christos // \u escapes with more than one u are invalid.
15 1.1 christos GetString ("Japanese: \uu65e5\uuu672c\u8A9e");
16 1.1 christos GetString ("embedded\nnewline");
17 1.1 christos // Spaces from end of comment are removed. %GetString("dummy");
18 1.1 christos // Two backslashes (unlike in Java, where this is just one backslash).
19 1.1 christos GetString ("\u005c\u005c");
20 1.1 christos // A 6-character string (unlike in Java, where this is just one backslash).
21 1.1 christos GetString ("\\u005c");
22 1.1 christos // A single backslash.
23 1.1 christos GetString ("\\");
24 1.1 christos // There is only one \u recognition pass.
25 1.1 christos GetString ("\u005cu005c");
26 1.1 christos // Octal escape sequences are not recognized, except for \0.
27 1.1 christos GetString ("\134");
28 1.1 christos // Escape sequences in strings.
29 1.1 christos GetString ("t -> \t, b -> \b, n -> \n, dquote -> \", squote -> \' ...");
30 1.1 christos // Hex escapes are recognized.
31 1.1 christos GetString ("bel: \x07\n");
32 1.1 christos GetString // Recognized despite comments
33 1.1 christos ( /* Even across multiline
34 1.1 christos comment! */ "this is a single " /* now comes the concatenation! */ + // after +
35 1.1 christos "long line");
36 1.1 christos // Verbatim string literals are extracted.
37 1.1 christos GetString (@"verbatim 1");
38 1.1 christos // In verbatim string literals, no escape sequences are recognized.
39 1.1 christos GetString (@"verbatim 2 \u005c \\ \t \b \n \'");
40 1.1 christos // In verbatim string literals, only doubled delimiters are recognized.
41 1.1 christos GetString (@"verbatim 3 ""test");
42 1.1 christos // Normal and verbatim string literals can be concatenated.
43 1.1 christos GetString ("left - \"quot" + @"ation"" - right");
44 1.1 christos // Character literals are not extracted.
45 1.1 christos GetString ('x');
46 1.1 christos // Invalid concatenations are not concatenated.
47 1.1 christos GetString ("fooba"+'r');
48 1.1 christos // Verify that a comma inside braces is hidden.
49 1.1 christos MyGetString (new Object[] { "don't", "fool", "me" }, "this is the second argument");
50 1.1 christos }
51 1.1 christos }
52 1.1 christos EOF
53 1.1 christos
54 1.1 christos tmpfiles="$tmpfiles xg-cs-3.po"
55 1.1 christos : ${XGETTEXT=xgettext}
56 1.1 christos # delete POT-Creation-Date: line because the date depends on local time.
57 1.1 christos ${XGETTEXT} --output - --add-location -c -kMyGetString:2 xg-cs-3.cs 2>/dev/null \
58 1.1 christos | sed '/\"POT-Creation-Date:.*/d' > xg-cs-3.po
59 1.1 christos test $? = 0 || { rm -fr $tmpfiles; exit 1; }
60 1.1 christos
61 1.1 christos tmpfiles="$tmpfiles xg-cs-3.ok"
62 1.1 christos cat <<\EOF > xg-cs-3.ok
63 1.1 christos # SOME DESCRIPTIVE TITLE.
64 1.1 christos # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
65 1.1 christos # This file is distributed under the same license as the PACKAGE package.
66 1.1 christos # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
67 1.1 christos #
68 1.1 christos #, fuzzy
69 1.1 christos msgid ""
70 1.1 christos msgstr ""
71 1.1 christos "Project-Id-Version: PACKAGE VERSION\n"
72 1.1 christos "Report-Msgid-Bugs-To: \n"
73 1.1 christos "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
74 1.1 christos "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
75 1.1 christos "Language-Team: LANGUAGE <LL (at] li.org>\n"
76 1.1 christos "MIME-Version: 1.0\n"
77 1.1 christos "Content-Type: text/plain; charset=UTF-8\n"
78 1.1 christos "Content-Transfer-Encoding: 8bit\n"
79 1.1 christos
80 1.1 christos #. Test recognition of \u escapes.
81 1.1 christos #: xg-cs-3.cs:4
82 1.1 christos msgid "Bse Bbchen"
83 1.1 christos msgstr ""
84 1.1 christos
85 1.1 christos #. \u escapes with more than one u are invalid.
86 1.1 christos #: xg-cs-3.cs:6
87 1.1 christos msgid "Japanese: \\uu65e5\\uuu672c"
88 1.1 christos msgstr ""
89 1.1 christos
90 1.1 christos #: xg-cs-3.cs:7
91 1.1 christos msgid ""
92 1.1 christos "embedded\n"
93 1.1 christos "newline"
94 1.1 christos msgstr ""
95 1.1 christos
96 1.1 christos #. Spaces from end of comment are removed.
97 1.1 christos #: xg-cs-3.cs:8
98 1.1 christos msgid "dummy"
99 1.1 christos msgstr ""
100 1.1 christos
101 1.1 christos #. Two backslashes (unlike in Java, where this is just one backslash).
102 1.1 christos #: xg-cs-3.cs:10
103 1.1 christos msgid "\\\\"
104 1.1 christos msgstr ""
105 1.1 christos
106 1.1 christos #. A 6-character string (unlike in Java, where this is just one backslash).
107 1.1 christos #. There is only one \u recognition pass.
108 1.1 christos #: xg-cs-3.cs:12 xg-cs-3.cs:16
109 1.1 christos msgid "\\u005c"
110 1.1 christos msgstr ""
111 1.1 christos
112 1.1 christos #. A single backslash.
113 1.1 christos #: xg-cs-3.cs:14
114 1.1 christos msgid "\\"
115 1.1 christos msgstr ""
116 1.1 christos
117 1.1 christos #. Octal escape sequences are not recognized, except for \0.
118 1.1 christos #: xg-cs-3.cs:18
119 1.1 christos msgid "\\134"
120 1.1 christos msgstr ""
121 1.1 christos
122 1.1 christos #. Escape sequences in strings.
123 1.1 christos #: xg-cs-3.cs:20
124 1.1 christos msgid ""
125 1.1 christos "t -> \t, b -> \b, n -> \n"
126 1.1 christos ", dquote -> \", squote -> ' ..."
127 1.1 christos msgstr ""
128 1.1 christos
129 1.1 christos #. Hex escapes are recognized.
130 1.1 christos #: xg-cs-3.cs:22
131 1.1 christos msgid "bel: \a\n"
132 1.1 christos msgstr ""
133 1.1 christos
134 1.1 christos #. Recognized despite comments
135 1.1 christos #. Even across multiline
136 1.1 christos #. comment!
137 1.1 christos #: xg-cs-3.cs:25
138 1.1 christos msgid "this is a single long line"
139 1.1 christos msgstr ""
140 1.1 christos
141 1.1 christos #. Verbatim string literals are extracted.
142 1.1 christos #: xg-cs-3.cs:28
143 1.1 christos msgid "verbatim 1"
144 1.1 christos msgstr ""
145 1.1 christos
146 1.1 christos #. In verbatim string literals, no escape sequences are recognized.
147 1.1 christos #: xg-cs-3.cs:30
148 1.1 christos msgid "verbatim 2 \\u005c \\\\ \\t \\b \\n \\'"
149 1.1 christos msgstr ""
150 1.1 christos
151 1.1 christos #. In verbatim string literals, only doubled delimiters are recognized.
152 1.1 christos #: xg-cs-3.cs:32
153 1.1 christos msgid "verbatim 3 \"test"
154 1.1 christos msgstr ""
155 1.1 christos
156 1.1 christos #. Normal and verbatim string literals can be concatenated.
157 1.1 christos #: xg-cs-3.cs:34
158 1.1 christos msgid "left - \"quotation\" - right"
159 1.1 christos msgstr ""
160 1.1 christos
161 1.1 christos #. Invalid concatenations are not concatenated.
162 1.1 christos #: xg-cs-3.cs:38
163 1.1 christos msgid "fooba"
164 1.1 christos msgstr ""
165 1.1 christos
166 1.1 christos #. Verify that a comma inside braces is hidden.
167 1.1 christos #: xg-cs-3.cs:40
168 1.1 christos msgid "this is the second argument"
169 1.1 christos msgstr ""
170 1.1 christos EOF
171 1.1 christos
172 1.1 christos : ${DIFF=diff}
173 1.1 christos ${DIFF} xg-cs-3.ok xg-cs-3.po
174 1.1 christos result=$?
175 1.1 christos
176 1.1 christos rm -fr $tmpfiles
177 1.1 christos
178 1.1 christos exit $result
179