Add tests for the C<my $x if foo> deprecation, and change the
[p5sagit/p5-mst-13.2.git] / t / op / mydef.t
index 0770e78..485f843 100644 (file)
@@ -5,7 +5,7 @@ BEGIN {
     @INC = '../lib';
 }
 
-print "1..64\n";
+print "1..66\n";
 
 my $test = 0;
 sub ok ($$) {
@@ -118,6 +118,12 @@ $_ = "global";
     ok( $x eq '1globallocal-2globallocal', 'map without {}' );
 }
 {
+    for my $_ (1) {
+       my $x = map $_, qw(a b);
+       ok( $x == 2, 'map in scalar context' );
+    }
+}
+{
     my $buf = '';
     sub tgrep1 { /(.)/; $buf .= $1 }
     my $_ = 'y';
@@ -142,6 +148,12 @@ $_ = "global";
     ok( $_ eq 'local', '...but without extraneous side-effects' );
 }
 {
+    for my $_ (1) {
+       my $x = grep $_, qw(a b);
+       ok( $x == 2, 'grep in scalar context' );
+    }
+}
+{
     my $s = "toto";
     my $_ = "titi";
     $s =~ /to(?{ ok( $_ eq 'toto', 'my $_ in code-match # TODO' ) })to/