This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Make the dUNDERBAR/UNDERBAR macros work as advertised.
[perl5.git] / t / op / mydef.t
index 0770e78..f089c31 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/
@@ -152,7 +164,7 @@ $_ = "global";
 {
     my $_ = "abc";
     my $x = reverse;
-    ok( $x eq "cba", 'reverse without arguments picks up $_ # TODO' );
+    ok( $x eq "cba", 'reverse without arguments picks up $_' );
 }
 
 {