diff options
author | Bruno Haible <bruno@clisp.org> | 2003-11-03 21:08:19 +0000 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2009-06-23 12:11:10 +0200 |
commit | cde548e80298a4c79e7514cdd3c27cc0dd0c56ef (patch) | |
tree | 6d1d6f19c03fb96ec9046b59ca0ba5585705c6ea /gettext-tools/tests/xgettext-java-2 | |
parent | 353f948b81e23dd015e3725a524b235cb3e0869f (diff) | |
download | external_gettext-cde548e80298a4c79e7514cdd3c27cc0dd0c56ef.zip external_gettext-cde548e80298a4c79e7514cdd3c27cc0dd0c56ef.tar.gz external_gettext-cde548e80298a4c79e7514cdd3c27cc0dd0c56ef.tar.bz2 |
Move xgettext-11 to xgettext-java-2.
Diffstat (limited to 'gettext-tools/tests/xgettext-java-2')
-rwxr-xr-x | gettext-tools/tests/xgettext-java-2 | 178 |
1 files changed, 178 insertions, 0 deletions
diff --git a/gettext-tools/tests/xgettext-java-2 b/gettext-tools/tests/xgettext-java-2 new file mode 100755 index 0000000..85646a7 --- /dev/null +++ b/gettext-tools/tests/xgettext-java-2 @@ -0,0 +1,178 @@ +#!/bin/sh +# +# More tests for java support +# + +tmpfiles="" +trap 'rm -fr $tmpfiles' 1 2 3 15 + +tmpfiles="$tmpfiles xg-test11.java" +cat <<\EOF > xg-test11.java +class TestCase { + public static void main (String[] args) { + // Test recognition of \u escapes: Bse Bbchen + gettext ("B\u00f6se B\u00fcbchen"); + // Test recognition of \u escapes with different number of u + gettext ("Japanese: \uu65e5\uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu672c\u8A9e"); + // Test recognition of \u escapes when they form UTF-16 surrogates + // Here: U+1D49E MATHEMATICAL SCRIPT CAPITAL C + gettext ("script \ud835\udc9e = ..."); + // Test invalid surrogates. + gettext ("invalid surrogate \ud835 first half"); + gettext ("invalid surrogate \udc9e second half"); + // Don't let the line numbers be confused by \u newlines. + \u000a \u000d \u000d\u000a + gettext ("embedded\nnewline"); + // Spaces from end of comment are removed. \u000agettext("dummy"); + // Various ways to write a backslash are equivalent. + gettext ("\u005c\u005c"); + gettext ("\u005c\"); + gettext ("\\u005c"); + gettext ("\\"); + gettext ("\134"); + // Escape sequences in strings. + gettext ("t -> \t, b -> \b, n -> \n, dquote -> \", squote -> \' ..."); + // Octal escapes have 2 or 3 digits, depending on the initial digit. + gettext ("bel: \7\nnewline: \12backslash: \134\ndquote-zero: \420\n"); + // Hex escapes are not recognized + gettext ("no bel: \x07\n"); + gettext // Recognized despite comments + ( /* Even across multiline +comment! */ "this is a single " /* now comes the concatenation! */ + // after + + "long line"); + // Character literals are not extracted. + gettext ('x'); + // Invalid concatenations are not concatenated. + gettext ("fooba"+'r'); + // Verify that the static function name has priority. + GettextResource.gettext("NOT extracted", "this one is extracted"); + // Verify that a comma inside braces is hidden. + GettextResource.gettext( + new Object() { + public int foo () { + return 5, 8; + } + }, + "this is the second argument"); + } +} +EOF + +tmpfiles="$tmpfiles xg-test11.tmp xg-test11.pot" +: ${XGETTEXT=xgettext} +${XGETTEXT} --from-code=ISO-8859-1 -c -o xg-test11.tmp xg-test11.java 2>/dev/null +test $? = 0 || { rm -fr $tmpfiles; exit 1; } +grep -v 'POT-Creation-Date' < xg-test11.tmp > xg-test11.pot + +tmpfiles="$tmpfiles xg-test11.ok" +cat <<\EOF > xg-test11.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" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Test recognition of \u escapes: Böse Bübchen +#: xg-test11.java:4 +msgid "Böse Bübchen" +msgstr "" + +#. Test recognition of \u escapes with different number of u +#: xg-test11.java:6 +msgid "Japanese: 日本語" +msgstr "" + +#. Test recognition of \u escapes when they form UTF-16 surrogates +#. Here: U+1D49E MATHEMATICAL SCRIPT CAPITAL C +#: xg-test11.java:9 +msgid "script 𝒞 = ..." +msgstr "" + +#. Test invalid surrogates. +#: xg-test11.java:11 +msgid "invalid surrogate � first half" +msgstr "" + +#: xg-test11.java:12 +msgid "invalid surrogate second half" +msgstr "" + +#. Don't let the line numbers be confused by \u newlines. +#: xg-test11.java:15 +msgid "" +"embedded\n" +"newline" +msgstr "" + +#. Spaces from end of comment are removed. +#: xg-test11.java:16 +msgid "dummy" +msgstr "" + +#. Various ways to write a backslash are equivalent. +#: xg-test11.java:18 xg-test11.java:19 xg-test11.java:20 xg-test11.java:21 +#: xg-test11.java:22 +msgid "\\" +msgstr "" + +#. Escape sequences in strings. +#: xg-test11.java:24 +msgid "" +"t -> \t, b -> \b, n -> \n" +", dquote -> \", squote -> ' ..." +msgstr "" + +#. Octal escapes have 2 or 3 digits, depending on the initial digit. +#: xg-test11.java:26 +msgid "" +"bel: \n" +"newline: \n" +"backslash: \\\n" +"dquote-zero: \"0\n" +msgstr "" + +#. Hex escapes are not recognized +#: xg-test11.java:28 +msgid "no bel: \\x07\n" +msgstr "" + +#. Recognized despite comments +#. Even across multiline +#. comment! +#: xg-test11.java:31 +msgid "this is a single long line" +msgstr "" + +#. Invalid concatenations are not concatenated. +#: xg-test11.java:36 +msgid "fooba" +msgstr "" + +#. Verify that the static function name has priority. +#: xg-test11.java:38 +msgid "this one is extracted" +msgstr "" + +#: xg-test11.java:46 +msgid "this is the second argument" +msgstr "" +EOF + +: ${DIFF=diff} +${DIFF} xg-test11.ok xg-test11.pot +result=$? + +rm -fr $tmpfiles + +exit $result |