diff options
author | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2006-10-17 16:07:04 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2006-10-17 16:07:04 +0000 |
commit | b13fd70a68ddf5966a8175e04009af31c9841332 (patch) | |
tree | 0f36f6edc1b8a9e7c973692c254ec03aee519e90 /t/comp | |
parent | c36568be88bd894c59f9e2994c64120ffb2941bb (diff) | |
download | perl-b13fd70a68ddf5966a8175e04009af31c9841332.tar.gz |
First attempt at implementing the _ prototype
p4raw-id: //depot/perl@29032
Diffstat (limited to 't/comp')
-rw-r--r-- | t/comp/uproto.t | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/t/comp/uproto.t b/t/comp/uproto.t new file mode 100644 index 0000000000..ba7dcd6cd6 --- /dev/null +++ b/t/comp/uproto.t @@ -0,0 +1,36 @@ +#!perl + +BEGIN { + chdir 't' if -d 't'; + @INC = '../lib'; + require "./test.pl"; +} + +plan(tests => 14); + +sub f($$_) { my $x = shift; is("@_", $x) } + +$foo = "FOO"; +my $bar = "BAR"; +$_ = 42; + +f("FOO xy", $foo, "xy"); +f("BAR zt", $bar, "zt"); +f("FOO 42", $foo); +f("BAR 42", $bar); +f("y 42", substr("xy",1,1)); +f("1 42", ("abcdef" =~ /abc/)); +f("not undef 42", $undef || "not undef"); +f(" 42", -f "no_such_file"); +f("FOOBAR 42", ($foo . $bar)); +f("FOOBAR 42", ($foo .= $bar)); +f("FOOBAR 42", $foo); + +eval q{ f("foo") }; +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/ ); + +&f(""); # no error + +# TODO: sub g(_) (doesn't work) |