Blame gettext-tools/tests/xgettext-perl-8

Packit Bot 06c835
#! /bin/sh
Packit Bot 06c835
. "${srcdir=.}/init.sh"; path_prepend_ . ../src
Packit Bot 06c835
Packit Bot 06c835
# The slash (/) and the question mark (?) serve a double-purpose in Perl.
Packit Bot 06c835
# Depending on the context they can either be an operator (division
Packit Bot 06c835
# or ternary respectively) or they are regex delimiters for pattern
Packit Bot 06c835
# matches.  This test case checks the proper recognition.
Packit Bot 06c835
Packit Bot 06c835
cat <<\EOF > xg-pl-8.pl
Packit Bot 06c835
info(__("using %s."), ($a->b() eq "auto" ? "" : ""));
Packit Bot 06c835
Packit Bot 06c835
print __"Question mark after string is an operator!\n";
Packit Bot 06c835
# ?; Re-sync.
Packit Bot 06c835
Packit Bot 06c835
@times = sort {$a - $b} split /,\s*/, $options
Packit Bot 06c835
    if (defined $options && $options);
Packit Bot 06c835
Packit Bot 06c835
print __"First slash in a an argument to a function starts a pattern match.";
Packit Bot 06c835
# /; Re-sync.
Packit Bot 06c835
Packit Bot 06c835
$0 =~ /xyz/ ? 'foo' : 'bar';
Packit Bot 06c835
Packit Bot 06c835
print __"Question mark after a regular pattern match is an operator!";
Packit Bot 06c835
# ?; Re-sync.
Packit Bot 06c835
Packit Bot 06c835
$0 =~ m{xyz} ? 'foo' : 'bar';
Packit Bot 06c835
Packit Bot 06c835
print __"Question mark after a nesting pattern match is an operator!";
Packit Bot 06c835
# ?; Re-sync.
Packit Bot 06c835
Packit Bot 06c835
$0 =~ m|xyz| ? 'foo' : 'bar';
Packit Bot 06c835
Packit Bot 06c835
print __"Question mark after a non-nesting pattern match is an operator!";
Packit Bot 06c835
# ?; Re-sync.
Packit Bot 06c835
Packit Bot 06c835
print __(<
Packit Bot 06c835
Line number for here documents is not correct.
Packit Bot 06c835
EOS
Packit Bot 06c835
Packit Bot 06c835
$foo = wantarray ? 1 : 0;
Packit Bot 06c835
Packit Bot 06c835
print __"The function wantarray does not take arguments!";
Packit Bot 06c835
# ?; Re-sync.
Packit Bot 06c835
Packit Bot 06c835
$foo = Something->method ? 1 : 0;
Packit Bot 06c835
Packit Bot 06c835
print __"Class method calls without parentheses do not accept arguments!";
Packit Bot 06c835
# ?; Re-sync.
Packit Bot 06c835
Packit Bot 06c835
$foo = $Something->method ? 1 : 0;
Packit Bot 06c835
Packit Bot 06c835
print __"Instance method calls without parentheses do not accept arguments!";
Packit Bot 06c835
# ?; Re-sync.
Packit Bot 06c835
Packit Bot 06c835
$foo = $Some->thing->method ? 1 : 0;
Packit Bot 06c835
Packit Bot 06c835
print __"Chained method calls without parentheses do not accept arguments!";
Packit Bot 06c835
# ?; Re-sync.
Packit Bot 06c835
Packit Bot 06c835
print __"Synching works.";
Packit Bot 06c835
EOF
Packit Bot 06c835
Packit Bot 06c835
: ${XGETTEXT=xgettext}
Packit Bot 06c835
${XGETTEXT} --omit-header -n \
Packit Bot 06c835
  -k__ \
Packit Bot 06c835
  -d xg-pl-8.tmp xg-pl-8.pl || exit 1
Packit Bot 06c835
LC_ALL=C tr -d '\r' < xg-pl-8.tmp.po > xg-pl-8.po || exit 1
Packit Bot 06c835
Packit Bot 06c835
cat <<\EOF > xg-pl-8.ok
Packit Bot 06c835
#: xg-pl-8.pl:1
Packit Bot 06c835
#, perl-format
Packit Bot 06c835
msgid "using %s."
Packit Bot 06c835
msgstr ""
Packit Bot 06c835
Packit Bot 06c835
#: xg-pl-8.pl:3
Packit Bot 06c835
msgid "Question mark after string is an operator!\n"
Packit Bot 06c835
msgstr ""
Packit Bot 06c835
Packit Bot 06c835
#: xg-pl-8.pl:9
Packit Bot 06c835
msgid "First slash in a an argument to a function starts a pattern match."
Packit Bot 06c835
msgstr ""
Packit Bot 06c835
Packit Bot 06c835
#: xg-pl-8.pl:14
Packit Bot 06c835
msgid "Question mark after a regular pattern match is an operator!"
Packit Bot 06c835
msgstr ""
Packit Bot 06c835
Packit Bot 06c835
#: xg-pl-8.pl:19
Packit Bot 06c835
msgid "Question mark after a nesting pattern match is an operator!"
Packit Bot 06c835
msgstr ""
Packit Bot 06c835
Packit Bot 06c835
#: xg-pl-8.pl:24
Packit Bot 06c835
msgid "Question mark after a non-nesting pattern match is an operator!"
Packit Bot 06c835
msgstr ""
Packit Bot 06c835
Packit Bot 06c835
#: xg-pl-8.pl:28
Packit Bot 06c835
msgid "Line number for here documents is not correct.\n"
Packit Bot 06c835
msgstr ""
Packit Bot 06c835
Packit Bot 06c835
#: xg-pl-8.pl:33
Packit Bot 06c835
msgid "The function wantarray does not take arguments!"
Packit Bot 06c835
msgstr ""
Packit Bot 06c835
Packit Bot 06c835
#: xg-pl-8.pl:38
Packit Bot 06c835
msgid "Class method calls without parentheses do not accept arguments!"
Packit Bot 06c835
msgstr ""
Packit Bot 06c835
Packit Bot 06c835
#: xg-pl-8.pl:43
Packit Bot 06c835
msgid "Instance method calls without parentheses do not accept arguments!"
Packit Bot 06c835
msgstr ""
Packit Bot 06c835
Packit Bot 06c835
#: xg-pl-8.pl:48
Packit Bot 06c835
msgid "Chained method calls without parentheses do not accept arguments!"
Packit Bot 06c835
msgstr ""
Packit Bot 06c835
Packit Bot 06c835
#: xg-pl-8.pl:51
Packit Bot 06c835
msgid "Synching works."
Packit Bot 06c835
msgstr ""
Packit Bot 06c835
EOF
Packit Bot 06c835
Packit Bot 06c835
: ${DIFF=diff}
Packit Bot 06c835
${DIFF} xg-pl-8.ok xg-pl-8.po
Packit Bot 06c835
result=$?
Packit Bot 06c835
Packit Bot 06c835
exit $result