]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
New xgettext Java tests.
authorBruno Haible <bruno@clisp.org>
Fri, 21 Sep 2001 14:47:07 +0000 (14:47 +0000)
committerBruno Haible <bruno@clisp.org>
Fri, 21 Sep 2001 14:47:07 +0000 (14:47 +0000)
tests/ChangeLog
tests/Makefile.am
tests/xgettext-10 [new file with mode: 0755]
tests/xgettext-11 [new file with mode: 0755]

index a0dd1ef73f7a2414f6c0af0d00e7e4e2dd621f2f..a2bdb45969d4cc8cc867df0c4dde3633a8e1fa05 100644 (file)
@@ -1,3 +1,12 @@
+2001-09-21  Bruno Haible  <haible@clisp.cons.org>
+
+       * Makefile.am (TESTS): Add xgettext-10, xgettext-11.
+
+2001-09-21  Tommy Johansson  <tommy.johansson@kanalen.org>
+
+       * xgettext-10: New file.
+       * xgettext-11: New file.
+
 2001-08-30  Bruno Haible  <haible@clisp.cons.org>
 
        * Makefile.am (TESTS_ENVIRONMENT): Define MSGCAT environment variable.
index 91ae8a94c2f9e62d79d0ba45200c7c4fdfd50b37..91de94b315a992f27807743aab92deea7307d79f 100644 (file)
@@ -32,7 +32,7 @@ TESTS = gettext-1 gettext-2 \
        msgunfmt-1 \
        msguniq-1 msguniq-2 msguniq-3 \
        xgettext-1 xgettext-2 xgettext-3 xgettext-4 xgettext-5 xgettext-6 \
-       xgettext-7 xgettext-8 xgettext-9 \
+       xgettext-7 xgettext-8 xgettext-9 xgettext-10 xgettext-11 \
        format-c-1 format-c-2 \
        format-java-1 format-java-2 \
        format-lisp-1 format-lisp-2 \
diff --git a/tests/xgettext-10 b/tests/xgettext-10
new file mode 100755 (executable)
index 0000000..9867998
--- /dev/null
@@ -0,0 +1,67 @@
+#!/bin/sh
+#
+# Some tests for java support
+#
+
+tmpfiles=""
+trap 'rm -fr $tmpfiles' 1 2 3 15
+
+tmpfiles="$tmpfiles xg-test10.java"
+cat <<EOF > xg-test10.java
+class TestCase {
+    public TestCase() {
+        ResourceBundle b = ResourceBundle.getBundle("test");
+        GetTextBundle b2 = (GetTextBundle)b;
+        // standard usage
+        String test1 = b.getString("Test String 1");
+        // gettext usage
+        String test2 = b2.gettext("Test String 2");
+
+        /* C style comment */
+        String test3 = b.getString("Test String 3");
+
+        // java "multiline" string
+        String test4 = b.getString("Test " +
+        "String " +
+        "4");
+
+        // empty string
+        String test5 = b.getString("");
+    }
+}
+EOF
+
+tmpfiles="$tmpfiles xg-test10.po"
+: ${XGETTEXT=xgettext}
+${XGETTEXT} --omit-header -c -d xg-test10 xg-test10.java
+
+tmpfiles="$tmpfiles xg-test10.ok"
+cat <<EOF > xg-test10.ok
+#. standard usage
+msgid "Test String 1"
+msgstr ""
+
+#. gettext usage
+msgid "Test String 2"
+msgstr ""
+
+#. C style comment
+msgid "Test String 3"
+msgstr ""
+
+#. java "multiline" string
+msgid "Test String 4"
+msgstr ""
+
+#. empty string
+msgid ""
+msgstr ""
+EOF
+
+: ${DIFF=diff}
+${DIFF} xg-test10.ok xg-test10.po
+result=$?
+
+rm -fr $tmpfiles
+
+exit $result
diff --git a/tests/xgettext-11 b/tests/xgettext-11
new file mode 100755 (executable)
index 0000000..2cc8fc6
--- /dev/null
@@ -0,0 +1,42 @@
+#!/bin/sh
+#
+# Some tests for java substring keyword support
+#
+
+tmpfiles=""
+trap 'rm -fr $tmpfiles' 1 2 3 15
+
+tmpfiles="$tmpfiles xg-test11.java"
+cat <<EOF > xg-test11.java
+class TestCase {
+    public TestCase() {
+          // test exception
+          throw new TestException("Test exception");
+          // empty exception text
+          throw new TestException("");
+    }
+}
+EOF
+
+tmpfiles="$tmpfiles xg-test11.po"
+: ${XGETTEXT=xgettext}
+${XGETTEXT} --omit-header -c --keyword-substring --keyword=Exception -d xg-test11 xg-test11.java
+
+tmpfiles="$tmpfiles xg-test11.ok"
+cat <<EOF > xg-test11.ok
+#. test exception
+msgid "Test exception"
+msgstr ""
+
+#. empty exception text
+msgid ""
+msgstr ""
+EOF
+
+: ${DIFF=diff}
+${DIFF} xg-test11.ok xg-test11.po
+result=$?
+
+rm -fr $tmpfiles
+
+exit $result