3 # More tests for java support
7 trap 'rm -fr $tmpfiles' 1 2 3 15
9 tmpfiles
="$tmpfiles xg-j-2.java"
10 cat <<\EOF
> xg-j-2.java
12 public static void main
(String
[] args
) {
13 // Test recognition of \u escapes
: Böse Bübchen
14 gettext ("B\u00f6se B\u00fcbchen");
15 // Test recognition of \u escapes with different number of u
16 gettext ("Japanese: \uu65e5\uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu672c\u8A9e");
17 // Test recognition of \u escapes when they form UTF-16 surrogates
18 // Here
: U
+1D49E MATHEMATICAL SCRIPT CAPITAL C
19 gettext ("script \ud835\udc9e = ...");
20 // Test invalid surrogates.
21 gettext ("invalid surrogate \ud835 first half");
22 gettext ("invalid surrogate \udc9e second half");
23 // Don
't let the line numbers be confused by \u newlines.
24 \u000a \u000d \u000d\u000a
25 gettext ("embedded\nnewline");
26 // Spaces from end of comment are removed. \u000agettext("dummy");
27 // Various ways to write a backslash are equivalent.
28 gettext ("\u005c\u005c");
33 // Escape sequences in strings.
34 gettext ("t -> \t, b -> \b, n -> \n, dquote -> \", squote -> \' ...");
35 // Octal escapes have 2 or 3 digits, depending on the initial digit.
36 gettext ("bel: \7\nnewline: \12backslash: \134\ndquote-zero: \420\n");
37 // Hex escapes are not recognized
38 gettext ("no bel: \x07\n");
39 gettext // Recognized despite comments
40 ( /* Even across multiline
41 comment! */ "this is a single " /* now comes the concatenation! */ + // after +
43 // Character literals are not extracted.
45 // Invalid concatenations are not concatenated.
46 gettext ("fooba"+'r
');
47 // Verify that the static function name has priority.
48 GettextResource.gettext("NOT extracted", "this one is extracted");
49 // Verify that a comma inside braces is hidden.
50 GettextResource.gettext(
56 "this is the second argument");
61 tmpfiles="$tmpfiles xg-j-2.tmp xg-j-2.pot"
62 : ${XGETTEXT=xgettext}
63 ${XGETTEXT} --from-code=ISO-8859-1 -c -o xg-j-2.tmp xg-j-2.java 2>/dev/null
64 test $? = 0 || { rm -fr $tmpfiles; exit 1; }
65 grep -v 'POT-Creation-Date
' < xg-j-2.tmp > xg-j-2.pot
67 tmpfiles="$tmpfiles xg-j-2.ok"
68 cat <<\EOF > xg-j-2.ok
69 # SOME DESCRIPTIVE TITLE.
70 # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
71 # This file is distributed under the same license as the PACKAGE package.
72 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
77 "Project-Id-Version: PACKAGE VERSION\n"
78 "Report-Msgid-Bugs-To: \n"
79 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
80 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
81 "Language-Team: LANGUAGE <LL@li.org>\n"
83 "Content-Type: text/plain; charset=UTF-8\n"
84 "Content-Transfer-Encoding: 8bit\n"
86 #. Test recognition of \u escapes: Böse Bübchen
91 #. Test recognition of \u escapes with different number of u
96 #. Test recognition of \u escapes when they form UTF-16 surrogates
97 #. Here: U+1D49E MATHEMATICAL SCRIPT CAPITAL C
99 msgid
"script 𝒞 = ..."
102 #. Test invalid surrogates.
104 msgid
"invalid surrogate � first half"
108 msgid
"invalid surrogate second half"
111 #. Don't let the line numbers be confused by \u newlines.
118 #. Spaces from end of comment are removed.
123 #. Various ways to write a backslash are equivalent.
124 #: xg-j-2.java:18 xg-j-2.java:19 xg-j-2.java:20 xg-j-2.java:21 xg-j-2.java:22
128 #. Escape sequences in strings.
131 "t -> \t, b -> \b, n -> \n"
132 ", dquote -> \", squote -> ' ..."
135 #. Octal escapes have 2 or 3 digits, depending on the initial digit.
144 #. Hex escapes are not recognized
146 msgid
"no bel: \\x07\n"
149 #. Recognized despite comments
150 #. Even across multiline
153 msgid
"this is a single long line"
156 #. Invalid concatenations are not concatenated.
161 #. Verify that the static function name has priority.
163 msgid
"this one is extracted"
167 msgid
"this is the second argument"
172 ${DIFF} xg-j-2.ok xg-j-2.pot