]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Test the xgettext Perl backend.
authorBruno Haible <bruno@clisp.org>
Sun, 15 Jun 2003 11:48:19 +0000 (11:48 +0000)
committerBruno Haible <bruno@clisp.org>
Tue, 23 Jun 2009 10:10:41 +0000 (12:10 +0200)
gettext-tools/tests/ChangeLog
gettext-tools/tests/Makefile.am
gettext-tools/tests/xgettext-26 [new file with mode: 0755]

index 9dc5090aecccad7da6f0a7cc744a482c6814103c..8a720c30ecef2ba4a027a342a7749d17768e162f 100644 (file)
@@ -1,3 +1,15 @@
+2003-06-15  Bruno Haible  <bruno@clisp.org>
+
+       * xgettext-26: New file, derived from lang-perl.
+       * Makefile.am (TESTS): Add it.
+       * lang-perl: Turn into a real integration test.
+
+2003-06-12  Bruno Haible  <bruno@clisp.org>
+
+       * format-perl-1: Avoid conflict with format-awk-1.
+       * format-perl-2: Avoid conflict with format-awk-2.
+       * Makefile.am (TESTS): Mention perl between tcl and php.
+
 2003-06-11  Guido Flohr  <guido@imperia.net>
 
        * format-perl-1: New file.
index 6b4d686f59fddd7ea99640a778bc0e41980968b6..349bdb9a53dbd91a7edac86339eaa5dc56eb885a 100644 (file)
@@ -49,7 +49,7 @@ TESTS = gettext-1 gettext-2 \
        xgettext-7 xgettext-8 xgettext-9 xgettext-10 xgettext-11 xgettext-12 \
        xgettext-13 xgettext-14 xgettext-15 xgettext-16 xgettext-17 \
        xgettext-18 xgettext-19 xgettext-20 xgettext-21 xgettext-22 \
-       xgettext-23 xgettext-24 xgettext-25 \
+       xgettext-23 xgettext-24 xgettext-25 xgettext-26 \
        format-awk-1 format-awk-2 \
        format-c-1 format-c-2 format-c-3 format-c-4 \
        format-elisp-1 format-elisp-2 \
diff --git a/gettext-tools/tests/xgettext-26 b/gettext-tools/tests/xgettext-26
new file mode 100755 (executable)
index 0000000..13f68e0
--- /dev/null
@@ -0,0 +1,148 @@
+#!/bin/sh
+
+# Test of Perl support.
+
+tmpfiles=""
+trap 'rm -fr $tmpfiles' 1 2 3 15
+
+tmpfiles="$tmpfiles xg-test26.pl"
+cat <<\EOF > xg-test26.pl
+use Locale::Messages;
+
+textdomain "prog";
+bindtextdomain ("./");
+
+s/foo/
+          # stress test for string extraction /xe;
+
+print _"'Your command, please?', asked the waiter.";
+
+printf ngettext ("a piece of cake", "%d pieces of cake", $n), $n;
+
+printf _"%s is replaced by %s.", "FF", "EUR";
+
+# Should be found.
+printf dngettext prog => ("one file deleted", "%d files deleted"), $n, $n;
+
+# Should not be found.
+printf dngettext ("prog"), ("one file created", "%d files created"), $n, $n;
+
+printf dngettext "prog", <<PERL, <<PERL;
+Singular
+PERL
+Plural
+PERL
+
+print <<PERL
+tied hash $__{   Bareword
+}
+tied hash $__->{"quoted string"}
+tied hash $__->{  "weird
+formatting"}
+PERL
+
+print $__  # Welcome
+   ->   # to the
+ { # Republic of
+ 'Welcome to the Republic of Perl!' # 
+# Perl!
+}; 
+
+$! ? ?$__{"pattern match"}? : s  # This is no delimiter.
+{$__{substitution}}<$__-\>{"find me"}>;
+
+# No interpolation!
+m'$__{secret}';
+
+# Multiple here documents invoked from the same line.
+print gettext <<PERL; print gettext <<PERL;
+First here document.
+PERL
+Second here document.
+PERL
+__END__
+gettext "Discarded!";
+EOF
+
+tmpfiles="$tmpfiles xg-test26.po"
+: ${XGETTEXT=xgettext}
+${XGETTEXT} --omit-header -n -k_ -k%__ -k\$__ xg-test26.pl -d xg-test26
+test $? = 0 || { rm -fr $tmpfiles; exit 1; }
+
+tmpfiles="$tmpfiles xg-test26.ok"
+cat <<EOF > xg-test26.ok
+#: xg-test26.pl:9
+msgid "'Your command, please?', asked the waiter."
+msgstr ""
+
+#: xg-test26.pl:11
+#, perl-format
+msgid "a piece of cake"
+msgid_plural "%d pieces of cake"
+msgstr[0] ""
+msgstr[1] ""
+
+#: xg-test26.pl:13
+#, perl-format
+msgid "%s is replaced by %s."
+msgstr ""
+
+#: xg-test26.pl:16
+#, perl-format
+msgid "one file deleted"
+msgid_plural "%d files deleted"
+msgstr[0] ""
+msgstr[1] ""
+
+#: xg-test26.pl:22
+msgid "Singular\n"
+msgid_plural "Plural\n"
+msgstr[0] ""
+msgstr[1] ""
+
+#: xg-test26.pl:28
+msgid "Bareword"
+msgstr ""
+
+#: xg-test26.pl:30
+msgid "quoted string"
+msgstr ""
+
+#: xg-test26.pl:31
+msgid ""
+"weird\n"
+"formatting"
+msgstr ""
+
+#: xg-test26.pl:38
+msgid "Welcome to the Republic of Perl!"
+msgstr ""
+
+#: xg-test26.pl:42
+msgid "pattern match"
+msgstr ""
+
+#: xg-test26.pl:43
+msgid "substitution"
+msgstr ""
+
+#: xg-test26.pl:43
+msgid "find me"
+msgstr ""
+
+#: xg-test26.pl:50
+msgid "First here document.\n"
+msgstr ""
+
+#: xg-test26.pl:52
+msgid "Second here document.\n"
+msgstr ""
+EOF
+
+: ${DIFF=diff}
+${DIFF} xg-test26.ok xg-test26.po
+result=$?
+
+rm -fr $tmpfiles
+
+exit $result