X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FSub-Op.git;a=blobdiff_plain;f=t%2F11-existing.t;h=0339bc850b391436f5fe1d7beb6bf97071f58562;hp=58e23a0a9c02e028f674db046f968171984c5b26;hb=5ae3324ff295015e051249ded13b2353ee8af258;hpb=cd64aa350186e54b47e313c566e5915f5aeddce9 diff --git a/t/11-existing.t b/t/11-existing.t index 58e23a0..0339bc8 100644 --- a/t/11-existing.t +++ b/t/11-existing.t @@ -5,11 +5,14 @@ use warnings; use blib 't/Sub-Op-LexicalSub'; -use Test::More tests => (4 + 2 * 4) + (2 * 5); +use Test::More tests => 2 *((4 + 2 * 4) + (2 * 5) + 1); our $call_foo; sub foo { ok $call_foo, 'the preexistent foo was called' } +our $call_bar; +sub bar () { ok $call_bar, 'the preexistent bar was called' } + our $called; { @@ -66,6 +69,9 @@ our $called; } } +is prototype('main::foo'), undef, "foo's prototype was preserved"; +is prototype('main::bar'), '', "bar's prototype was preserved"; + __DATA__ foo(); ---- @@ -109,3 +115,46 @@ my $foo = \&foo; &$foo; ---- foo # () # +#### +bar(); +---- +bar # () # [ ] +#### +bar; +---- +bar # () # [ ] +#### +bar(1); +---- +bar # () # [ 1 ] +#### +bar 2; +---- +bar # () # [ 2 ] +#### +local $call_bar = 1; +&bar(); +---- +bar # () # +#### +local $call_bar = 1; +&bar; +---- +bar # () # +#### +local $call_bar = 1; +&bar(3); +---- +bar # () # +#### +local $call_bar = 1; +my $bar = \&bar; +$bar->(); +---- +bar # () # +#### +local $call_bar = 1; +my $bar = \&bar; +&$bar; +---- +bar # () #