2 . "${srcdir=.}/init.sh"; path_prepend_ . ../src
4 # The slash (/) and the question mark (?) serve a double-purpose in Perl.
5 # Depending on the context they can either be an operator (division
6 # or ternary respectively) or they are regex delimiters for pattern
7 # matches. This test case checks the proper recognition.
9 cat <<\EOF > xg-pl-8.pl
10 info(__("using %s."), ($a->b() eq "auto" ? "" : ""));
12 print __"Question mark after string is an operator!\n";
15 @times = sort {$a - $b} split /,\s*/, $options
16 if (defined $options && $options);
18 print __"First slash in a an argument to a function starts a pattern match.";
21 $0 =~ /xyz/ ? 'foo' : 'bar';
23 print __"Question mark after a regular pattern match is an operator!";
26 $0 =~ m{xyz} ? 'foo' : 'bar';
28 print __"Question mark after a nesting pattern match is an operator!";
31 $0 =~ m|xyz| ? 'foo' : 'bar';
33 print __"Question mark after a non-nesting pattern match is an operator!";
37 Line number for here documents is not correct.
40 $foo = wantarray ? 1 : 0;
42 print __"The function wantarray does not take arguments!";
45 $foo = Something->method ? 1 : 0;
47 print __"Class method calls without parentheses do not accept arguments!";
50 $foo = $Something->method ? 1 : 0;
52 print __"Instance method calls without parentheses do not accept arguments!";
55 $foo = $Some->thing->method ? 1 : 0;
57 print __"Chained method calls without parentheses do not accept arguments!";
60 print __"Synching works.";
63 : ${XGETTEXT=xgettext}
64 ${XGETTEXT} --omit-header -n \
66 -d xg-pl-8.tmp xg-pl-8.pl || exit 1
67 LC_ALL=C tr -d '\r' < xg-pl-8.tmp.po > xg-pl-8.po || exit 1
69 cat <<\EOF > xg-pl-8.ok
76 msgid "Question mark after string is an operator!\n"
80 msgid "First slash in a an argument to a function starts a pattern match."
84 msgid "Question mark after a regular pattern match is an operator!"
88 msgid "Question mark after a nesting pattern match is an operator!"
92 msgid "Question mark after a non-nesting pattern match is an operator!"
96 msgid "Line number for here documents is not correct.\n"
100 msgid "The function wantarray does not take arguments!"
104 msgid "Class method calls without parentheses do not accept arguments!"
108 msgid "Instance method calls without parentheses do not accept arguments!"
112 msgid "Chained method calls without parentheses do not accept arguments!"
116 msgid "Synching works."
121 ${DIFF} xg-pl-8.ok xg-pl-8.po