2 . "${srcdir=.}/init.sh"; path_prepend_ . ../src
4 # More tests for java support
7 cat <<\EOF > xg-j-2.java
9 public static void main (String[] args) {
10 // Test recognition of \u escapes: Böse Bübchen
11 gettext ("B\u00f6se B\u00fcbchen");
12 // Test recognition of \u escapes with different number of u
13 gettext ("Japanese: \uu65e5\uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu672c\u8A9e");
14 // Test recognition of \u escapes when they form UTF-16 surrogates
15 // Here: U+1D49E MATHEMATICAL SCRIPT CAPITAL C
16 gettext ("script \ud835\udc9e = ...");
17 // Test invalid surrogates.
18 gettext ("invalid surrogate \ud835 first half");
19 gettext ("invalid surrogate \udc9e second half");
20 // Don't let the line numbers be confused by \u newlines.
21 \u000a \u000d \u000d\u000a
22 gettext ("embedded\nnewline");
23 // Spaces from end of comment are removed. \u000agettext("dummy");
24 // Various ways to write a backslash are equivalent.
25 gettext ("\u005c\u005c");
30 // Escape sequences in strings.
31 gettext ("t -> \t, b -> \b, n -> \n, dquote -> \", squote -> \' ...");
32 // Octal escapes have 2 or 3 digits, depending on the initial digit.
33 gettext ("bel: \7\nnewline: \12backslash: \134\ndquote-zero: \420\n");
34 // Hex escapes are not recognized
35 gettext ("no bel: \x07\n");
36 gettext // Recognized despite comments
37 ( /* Even across multiline
38 comment! */ "this is a single " /* now comes the concatenation! */ + // after +
40 // Character literals are not extracted.
42 // Invalid concatenations are not concatenated.
43 gettext ("fooba"+'r');
44 // Verify that the static function name has priority.
45 GettextResource.gettext("NOT extracted", "this one is extracted");
46 // Verify that a comma inside braces is hidden.
47 GettextResource.gettext(
53 "this is the second argument");
58 : ${XGETTEXT=xgettext}
59 ${XGETTEXT} --from-code=ISO-8859-1 -c -o xg-j-2.tmp xg-j-2.java 2>/dev/null || exit 1
60 # Don't simplify this to "grep ... < xg-j-2.tmp", otherwise OpenBSD 4.0 grep
61 # only outputs "Binary file (standard input) matches".
62 cat xg-j-2.tmp | grep -v 'POT-Creation-Date' | LC_ALL=C tr -d '\r' > xg-j-2.pot
64 cat <<\EOF > xg-j-2.ok
65 # SOME DESCRIPTIVE TITLE.
66 # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
67 # This file is distributed under the same license as the PACKAGE package.
68 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
73 "Project-Id-Version: PACKAGE VERSION\n"
74 "Report-Msgid-Bugs-To: \n"
75 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
76 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
77 "Language-Team: LANGUAGE <LL@li.org>\n"
80 "Content-Type: text/plain; charset=UTF-8\n"
81 "Content-Transfer-Encoding: 8bit\n"
83 #. Test recognition of \u escapes: Böse Bübchen
88 #. Test recognition of \u escapes with different number of u
93 #. Test recognition of \u escapes when they form UTF-16 surrogates
94 #. Here: U+1D49E MATHEMATICAL SCRIPT CAPITAL C
96 msgid "script 𝒞 = ..."
99 #. Test invalid surrogates.
101 msgid "invalid surrogate � first half"
105 msgid "invalid surrogate � second half"
108 #. Don't let the line numbers be confused by \u newlines.
115 #. Spaces from end of comment are removed.
120 #. Various ways to write a backslash are equivalent.
121 #: 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
125 #. Escape sequences in strings.
128 "t -> \t, b -> \b, n -> \n"
129 ", dquote -> \", squote -> ' ..."
132 #. Octal escapes have 2 or 3 digits, depending on the initial digit.
141 #. Hex escapes are not recognized
143 msgid "no bel: \\x07\n"
146 #. Recognized despite comments
147 #. Even across multiline
150 msgid "this is a single long line"
153 #. Invalid concatenations are not concatenated.
158 #. Verify that the static function name has priority.
160 msgid "this one is extracted"
164 msgid "this is the second argument"
169 ${DIFF} xg-j-2.ok xg-j-2.pot