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;
{
}
}
+is prototype('main::foo'), undef, "foo's prototype was preserved";
+is prototype('main::bar'), '', "bar's prototype was preserved";
+
__DATA__
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 # () #