From 6a8363ef2fc984d5f5904d9ae083a612bd6c80b6 Mon Sep 17 00:00:00 2001 From: Rafael Garcia-Suarez Date: Thu, 2 Nov 2006 10:32:18 +0000 Subject: [PATCH] More regression tests for the _ prototype p4raw-id: //depot/perl@29185 --- t/comp/uproto.t | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) 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' ); +} -- 2.7.4