projects
/
platform
/
upstream
/
perl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
2afd7d8
)
More regression tests for the _ prototype
author
Rafael Garcia-Suarez
<rgarciasuarez@gmail.com>
Thu, 2 Nov 2006 10:32:18 +0000
(10:32 +0000)
committer
Rafael Garcia-Suarez
<rgarciasuarez@gmail.com>
Thu, 2 Nov 2006 10:32:18 +0000
(10:32 +0000)
p4raw-id: //depot/perl@29185
t/comp/uproto.t
patch
|
blob
|
history
diff --git
a/t/comp/uproto.t
b/t/comp/uproto.t
index
3da64d4
..
b82a5a3
100644
(file)
--- a/
t/comp/uproto.t
+++ b/
t/comp/uproto.t
@@
-6,7
+6,7
@@
BEGIN {
require "./test.pl";
}
-plan(tests => 3
6
);
+plan(tests => 3
8
);
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' );
+}