2 . "${srcdir=.}/init.sh"; path_prepend_ . ../src
4 # Tests for the general string extraction facilities of the Perl backend
5 # (with option --extract-all).
7 cat <<\EOPERL > xg-pl-4.pl
10 # A double quoted string.
11 print "'Your command, please?', asked the waiter.\n";
12 # A double quoted string with interpolations.
13 my $polite = 'please';
14 print "'Your recommendation, $polite?', answered the guest.\n";
19 print "Yes, $$$$ref3!\n";
20 # The qq operator and some of the more esoteric string interpolation
22 print (qq {\uU\lp \LaNd\E \ldo\lWn, \Uoh\E, yeah\Q!!!\E\\!\n});
24 print q<E-Mail: <no@spam.org>. >;
25 # Should not be found.
29 print "Your Perl include path starts with '$INC[0]' and it " .
30 "ends with '$INC[-1]'. $#INC directories are searched.\n";
37 # Perl code inside strings.
38 sub hello_func { return 'Hello' };
39 print "@{[hello_func]} world!\n";
44 if (!defined($size = -s $filename)) {
45 # The above s is part of the function -s, not
46 # the substitution operator!
49 # The rest requires a Unicode aware Perl.
51 print "\U\x70\LO\154\x{69}\x{004E}a \Q\lRu\LLeS\E\041\n";
52 # FIXME: The following should actually produce 'Polina4ka' in cyrillic letters.
53 #print "\u\x{43f}\L\x{41E}\x{43b}\x{418}\E\x{43d}" .
54 # "\x{430}\x{447}\x{43a}\x{430}\n";
57 : ${XGETTEXT=xgettext}
58 LC_MESSAGES=C LC_ALL= \
59 ${XGETTEXT} -a --omit-header --no-location -o xg-pl-4.tmp.pot xg-pl-4.pl || exit 1
60 LC_ALL=C tr -d '\r' < xg-pl-4.tmp.pot > xg-pl-4.pot || exit 1
62 cat <<\EOF > xg-pl-4.ok
63 msgid "'Your command, please?', asked the waiter.\n"
69 msgid "'Your recommendation, $polite?', answered the guest.\n"
72 msgid "Yes, $$$$ref3!\n"
75 msgid "Up and down, OH, yeah\\!\\!\\!\\!\n"
78 msgid "E-Mail: <no@spam.org>. "
82 "Your Perl include path starts with '$INC[0]' and it ends with '$INC[-1]'. "
83 "$#INC directories are searched.\n"
91 msgid "Line 1\\nStill line 1\n"
97 msgid "@{[hello_func]} world!\n"
103 msgid "Polina rules!\n"
108 ${DIFF} xg-pl-4.ok xg-pl-4.pot