3 # Tests for the general string extraction facilities of the Perl backend
4 # (with option --extract-all).
7 trap 'rm -fr $tmpfiles' 1 2 3 15
9 tmpfiles
="$tmpfiles xg-pl-4.pl"
10 cat <<\EOPERL
> xg-pl-4.pl
13 # A double quoted string.
14 print
"'Your command, please?', asked the waiter.\n";
15 # A double quoted string with interpolations.
16 my
$polite = 'please';
17 print
"'Your recommendation, $polite?', answered the guest.\n";
22 print
"Yes, $$$$ref3!\n";
23 # The qq operator and some of the more esoteric string interpolation
25 print
(qq
{\uU\
lp \LaNd\E \ldo\lWn
, \Uoh\E
, yeah\Q
!!!\E
\\!\n});
27 print q
<E-Mail
: <no@spam.org
>.
>;
28 # Should not be found.
32 print
"Your Perl include path starts with '$INC[0]' and it " .
33 "ends with '$INC[-1]'. $#INC directories are searched.\n";
40 # Perl code inside strings.
41 sub hello_func
{ return 'Hello' };
42 print
"@{[hello_func]} world!\n";
47 if (!defined
($size = -s $filename)) {
48 # The above s is part of the function -s, not
49 # the substitution operator!
52 # The rest requires a Unicode aware Perl.
54 print
"\U\x70\LO\154\x{69}\x{004E}a \Q\lRu\LLeS\E\041\n";
55 # FIXME: The following should actually produce 'Polina4ka' in cyrillic letters.
56 #print "\u\x{43f}\L\x{41E}\x{43b}\x{418}\E\x{43d}" .
57 # "\x{430}\x{447}\x{43a}\x{430}\n";
60 tmpfiles
="$tmpfiles xg-pl-4.pot"
61 : ${XGETTEXT=xgettext}
62 LC_MESSAGES
=C LC_ALL
= \
63 ${XGETTEXT} -a --omit-header --no-location -o xg-pl-4.pot xg-pl-4.pl
64 test $?
= 0 ||
{ rm -fr $tmpfiles; exit 1; }
66 tmpfiles
="$tmpfiles xg-pl-4.ok"
67 cat <<\EOF
> xg-pl-4.ok
68 msgid
"'Your command, please?', asked the waiter.\n"
74 msgid
"'Your recommendation, $polite?', answered the guest.\n"
77 msgid
"Yes, $$$$ref3!\n"
80 msgid
"Up and down, OH, yeah\\!\\!\\!\\!\n"
83 msgid
"E-Mail: <no@spam.org>. "
87 "Your Perl include path starts with '$INC[0]' and it ends with '$INC[-1]'. "
88 "$#INC directories are searched.\n"
96 msgid
"Line 1\\nStill line 1\n"
102 msgid
"@{[hello_func]} world!\n"
108 msgid
"Polina rules!\n"
113 ${DIFF} xg-pl-4.ok xg-pl-4.pot