t/x2p/s2p.t fix for VMS in UNIX mode
[p5sagit/p5-mst-13.2.git] / t / comp / uproto.t
index f5472d5..9b908eb 100644 (file)
@@ -6,7 +6,7 @@ BEGIN {
     require "./test.pl";
 }
 
-plan(tests => 32);
+plan(tests => 39);
 
 sub f($$_) { my $x = shift; is("@_", $x) }
 
@@ -55,6 +55,7 @@ g("foo");
 g($expected);
 $_ = $expected;
 g();
+g;
 undef $expected; &g; # $_ not passed
 { $expected = my $_ = "bar"; g() }
 
@@ -66,3 +67,23 @@ like( $@, qr/Malformed prototype for main::wrong2/, 'wrong2' );
 
 sub opt ($;_) { is($_[0], "seen"); ok(!defined $_[1], "; has precedence over _") }
 opt("seen");
+
+sub unop (_) { is($_[0], 11, "unary op") }
+unop 11, 22; # takes only the first parameter into account
+
+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' );
+}