]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
New tests for extraction of concatenated strings in PHP mode.
authorBruno Haible <bruno@clisp.org>
Thu, 5 Jul 2007 00:07:55 +0000 (00:07 +0000)
committerBruno Haible <bruno@clisp.org>
Tue, 23 Jun 2009 10:14:59 +0000 (12:14 +0200)
gettext-tools/tests/Makefile.am
gettext-tools/tests/xgettext-php-3
gettext-tools/tests/xgettext-php-4 [new file with mode: 0755]

index 6a4c5fb06b05c39509facebc119d31084c862bb8..7eaf27860e4723b6656fe3b0d2e0bb40c8ca22b8 100644 (file)
@@ -84,7 +84,7 @@ TESTS = gettext-1 gettext-2 gettext-3 gettext-4 gettext-5 gettext-6 gettext-7 \
        xgettext-objc-1 xgettext-objc-2 \
        xgettext-perl-1 xgettext-perl-2 xgettext-perl-3 xgettext-perl-4 \
        xgettext-perl-5 xgettext-perl-6 xgettext-perl-7 \
-       xgettext-php-1 xgettext-php-2 xgettext-php-3 \
+       xgettext-php-1 xgettext-php-2 xgettext-php-3 xgettext-php-4 \
        xgettext-po-1 \
        xgettext-properties-1 \
        xgettext-python-1 xgettext-python-2 xgettext-python-3 \
index fb5fdb0396ba376a7ccf486398838bdafb8fbdc4..c72430e607836ca77ef449d68242b05f88227472 100755 (executable)
@@ -11,7 +11,7 @@ cat <<\EOF > xg-ph-3.php
 /* a */
 /* b */ string = /* c */
 /* d */
-/* e */ _( /* f */ "hello world" /* g */ );
+/* e */ _( /* f */ "hello " /* g */ . /* h */ "world" /* i */ );
 ?>
 EOF
 
diff --git a/gettext-tools/tests/xgettext-php-4 b/gettext-tools/tests/xgettext-php-4
new file mode 100755 (executable)
index 0000000..fbbcfdc
--- /dev/null
@@ -0,0 +1,61 @@
+#!/bin/sh
+
+# Test PHP support: string concatenation.
+
+tmpfiles=""
+trap 'rm -fr $tmpfiles' 1 2 3 15
+
+tmpfiles="$tmpfiles xg-ph-4.php"
+cat <<EOF > xg-ph-4.php
+<?
+echo _("foo"."bar");
+echo _("hello " .
+"world");
+echo _("1" + "2" . "3");
+echo _("4" . "5" + "6");
+echo _("7" . "8" . "9");
+?>
+EOF
+
+tmpfiles="$tmpfiles xg-ph-4.tmp.po xg-ph-4.po"
+: ${XGETTEXT=xgettext}
+${XGETTEXT} --omit-header --no-location --extract-all \
+  -d xg-ph-4.tmp xg-ph-4.php
+test $? = 0 || { rm -fr $tmpfiles; exit 1; }
+tr -d '\r' < xg-ph-4.tmp.po > xg-ph-4.po
+test $? = 0 || { rm -fr $tmpfiles; exit 1; }
+
+tmpfiles="$tmpfiles xg-ph-4.ok"
+cat <<EOF > xg-ph-4.ok
+msgid "foobar"
+msgstr ""
+
+msgid "hello world"
+msgstr ""
+
+msgid "1"
+msgstr ""
+
+msgid "2"
+msgstr ""
+
+msgid "3"
+msgstr ""
+
+msgid "45"
+msgstr ""
+
+msgid "6"
+msgstr ""
+
+msgid "789"
+msgstr ""
+EOF
+
+: ${DIFF=diff}
+${DIFF} xg-ph-4.ok xg-ph-4.po
+result=$?
+
+rm -fr $tmpfiles
+
+exit $result