From: Rafael Garcia-Suarez Date: Thu, 2 Nov 2006 10:32:18 +0000 (+0000) Subject: More regression tests for the _ prototype X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6a8363ef2fc984d5f5904d9ae083a612bd6c80b6;p=p5sagit%2Fp5-mst-13.2.git More regression tests for the _ prototype p4raw-id: //depot/perl@29185 --- diff --git a/t/comp/uproto.t b/t/comp/uproto.t index 3da64d4..b82a5a3 100644 --- a/t/comp/uproto.t +++ b/t/comp/uproto.t @@ -6,7 +6,7 @@ BEGIN { require "./test.pl"; } -plan(tests => 36); +plan(tests => 38); sub f($$_) { my $x = shift; is("@_", $x) } @@ -74,3 +74,15 @@ sub mymkdir (_;$) { is("@_", $expected, "mymkdir") } $expected = $_ = "mydir"; mymkdir(); mymkdir($expected = "foo"); $expected = "foo 493"; mymkdir foo => 0755; + +# $_ says modifiable, it's not passed by copy + +sub double(_) { $_[0] *= 2 } +$_ = 21; +double(); +is( $_, 42, '$_ is modifiable' ); +{ + my $_ = 22; + double(); + is( $_, 44, 'my $_ is modifiable' ); +}