summaryrefslogtreecommitdiff
path: root/t/comp/uproto.t
diff options
context:
space:
mode:
Diffstat (limited to 't/comp/uproto.t')
-rw-r--r--t/comp/uproto.t27
1 files changed, 25 insertions, 2 deletions
diff --git a/t/comp/uproto.t b/t/comp/uproto.t
index ba7dcd6cd6..16c748a5bb 100644
--- a/t/comp/uproto.t
+++ b/t/comp/uproto.t
@@ -6,7 +6,7 @@ BEGIN {
require "./test.pl";
}
-plan(tests => 14);
+plan(tests => 28);
sub f($$_) { my $x = shift; is("@_", $x) }
@@ -31,6 +31,29 @@ like( $@, qr/Not enough arguments for main::f at/ );
eval q{ f(1,2,3,4) };
like( $@, qr/Too many arguments for main::f at/ );
+{
+ my $_ = "quarante-deux";
+ $foo = "FOO";
+ $bar = "BAR";
+ f("FOO quarante-deux", $foo);
+ f("BAR quarante-deux", $bar);
+ f("y quarante-deux", substr("xy",1,1));
+ f("1 quarante-deux", ("abcdef" =~ /abc/));
+ f("not undef quarante-deux", $undef || "not undef");
+ f(" quarante-deux", -f "no_such_file");
+ f("FOOBAR quarante-deux", ($foo . $bar));
+ f("FOOBAR quarante-deux", ($foo .= $bar));
+ f("FOOBAR quarante-deux", $foo);
+}
+
&f(""); # no error
-# TODO: sub g(_) (doesn't work)
+sub g(_) { is(shift, $expected) }
+
+$expected = "foo";
+g("foo");
+g($expected);
+$_ = $expected;
+g();
+undef $expected; &g; # $_ not passed
+{ $expected = my $_ = "bar"; g() }