X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2Fsubs-auto.git;a=blobdiff_plain;f=t%2F12-proto.t;h=10c59bbc8c56af672f86d1a1c1a4b173a1ce0994;hp=db7b1351a9bd74c353178245e19c9b706dec68df;hb=9225a4d4d98ce59fb492c93299851d7f7a738518;hpb=165818cffecf91be6cc7ed482d71b728731e7d4a diff --git a/t/12-proto.t b/t/12-proto.t index db7b135..10c59bb 100644 --- a/t/12-proto.t +++ b/t/12-proto.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => 7; +use Test::More tests => 11; my $foo; sub foo ($) { $foo = $_[0] }; @@ -21,6 +21,10 @@ eval { my @x = (1, 5); foo @x }; is($@, '', 'foo was compiled ok'); is($foo, 2, 'foo was called with the right arguments'); +eval { my @x = (1, 5); &foo(@x) }; +is($@, '', '&foo was compiled ok'); +is($foo, 1, '&foo was called with the right arguments'); + my $bar; sub bar (\@) { $bar = 0; $bar += $_ for grep defined, @{$_[0]} } @@ -28,6 +32,10 @@ eval { my @x = (2, 3, 4); bar @x }; is($@, '', 'bar was compiled ok'); is($bar, 9, 'bar was called with the right arguments'); +eval { my @x = ([2, 3], 4); &bar(@x) }; +is($@, '', '&bar was compiled ok'); +is($bar, 5, '&bar was called with the right arguments'); + eval { baz 5 }; like($@, qr/^Undefined\s+subroutine\s+&?main::baz/,'baz couldn\'t be compiled'); is($baz, undef, 'baz can\'t be called because of the prototype mismatch');