5 my ( $cona, $testnum ) = @_;
6 my $conb = (defined wantarray) ? ( wantarray ? 'A' : 'S' ) : 'V';
7 unless ( $cona eq $conb ) {
8 print "# Context $conb should be $cona\nnot ";
10 print "ok $testnum\n";
16 scalar context('S',4);
17 $a = scalar context('S',5);
18 ($a) = context('A',6);
19 ($a) = scalar context('S',7);
22 # [ID 20020626.011] incorrect wantarray optimisation
23 sub simple { wantarray ? 1 : 2 }
25 my $a = wantarray ? simple() : simple();
30 print +(@b == 1 && "@b" eq "2") ? "ok 8\n" : "not ok 8\t# <@b>\n";
31 print +($c == 2) ? "ok 9\n" : "not ok 9\t# <$c>\n";
35 $q = (defined wantarray) ? ( wantarray ? 'A' : 'S' ) : 'V';
38 print $q eq 'V' ? "ok 10\n" : "not ok 10\n";
40 print $q eq 'S' ? "ok 11\n" : "not ok 11\n";
42 print $q eq 'A' ? "ok 12\n" : "not ok 12\n";