summaryrefslogtreecommitdiff
path: root/t/op/lexsub.t
diff options
context:
space:
mode:
authorDagfinn Ilmari Mannsåker <ilmari@ilmari.org>2013-06-27 16:48:36 +0100
committerRicardo Signes <rjbs@cpan.org>2013-12-22 13:28:20 -0500
commit8c74b41425572faeb638f1269025b59d0785794f (patch)
tree968acdd55f7bc4c12ad7784d21ba7a19389f9014 /t/op/lexsub.t
parent919ec23b10e41ed5c6aaf77a8ae3d2f7ef279f1b (diff)
downloadperl-8c74b41425572faeb638f1269025b59d0785794f.tar.gz
Remove support for "do SUBROUTINE(LIST)"
It's been deprecated (and emitting a warning) since Perl v5.0.0, and support for it consitutes nearly 3% of the grammar.
Diffstat (limited to 't/op/lexsub.t')
-rw-r--r--t/op/lexsub.t31
1 files changed, 1 insertions, 30 deletions
diff --git a/t/op/lexsub.t b/t/op/lexsub.t
index 07bfce542c..8c71da0390 100644
--- a/t/op/lexsub.t
+++ b/t/op/lexsub.t
@@ -7,8 +7,7 @@ BEGIN {
*bar::is = *is;
*bar::like = *like;
}
-no warnings 'deprecated';
-plan 140;
+plan 120;
# -------------------- Errors with feature disabled -------------------- #
@@ -30,17 +29,14 @@ use feature 'lexical_subs';
our sub foo { 42 }
is foo, 42, 'calling our sub from same package';
is &foo, 42, 'calling our sub from same package (amper)';
- is do foo(), 42, 'calling our sub from same package (do)';
package bar;
sub bar::foo { 43 }
is foo, 42, 'calling our sub from another package';
is &foo, 42, 'calling our sub from another package (amper)';
- is do foo(), 42, 'calling our sub from another package (do)';
}
package bar;
is foo, 43, 'our sub falling out of scope';
is &foo, 43, 'our sub falling out of scope (called via amper)';
-is do foo(), 43, 'our sub falling out of scope (called via amper)';
package main;
{
sub bar::a { 43 }
@@ -49,7 +45,6 @@ package main;
package bar;
is a, 43, 'our sub invisible inside itself';
is &a, 43, 'our sub invisible inside itself (called via amper)';
- is do a(), 43, 'our sub invisible inside itself (called via do)';
}
42
}
@@ -61,7 +56,6 @@ package main;
package bar;
is b, 42, 'our sub visible inside itself after decl';
is &b, 42, 'our sub visible inside itself after decl (amper)';
- is do b(), 42, 'our sub visible inside itself after decl (do)';
}
42
}
@@ -74,7 +68,6 @@ sub bar::c { 43 }
package bar;
is c, 42, 'our sub foo; makes lex alias for existing sub';
is &c, 42, 'our sub foo; makes lex alias for existing sub (amper)';
- is do c(), 42, 'our sub foo; makes lex alias for existing sub (do)';
}
{
our sub d;
@@ -104,23 +97,19 @@ use feature 'state'; # state
isnt \&::foo, \&foo, 'state sub is not stored in the package';
is eval foo, 44, 'calling state sub from same package';
is eval &foo, 44, 'calling state sub from same package (amper)';
- is eval do foo(), 44, 'calling state sub from same package (do)';
package bar;
is eval foo, 44, 'calling state sub from another package';
is eval &foo, 44, 'calling state sub from another package (amper)';
- is eval do foo(), 44, 'calling state sub from another package (do)';
}
package bar;
is foo, 43, 'state sub falling out of scope';
is &foo, 43, 'state sub falling out of scope (called via amper)';
-is do foo(), 43, 'state sub falling out of scope (called via amper)';
{
sub sa { 43 }
state sub sa {
if (shift) {
is sa, 43, 'state sub invisible inside itself';
is &sa, 43, 'state sub invisible inside itself (called via amper)';
- is do sa(), 43, 'state sub invisible inside itself (called via do)';
}
44
}
@@ -137,9 +126,6 @@ is do foo(), 43, 'state sub falling out of scope (called via amper)';
eval{&sb};
like $@, qr/^Undefined subroutine &sb called at /,
'state sub foo {} after forward declaration (amper)';
- eval{do sb()};
- like $@, qr/^Undefined subroutine &sb called at /,
- 'state sub foo {} after forward declaration (do)';
}
44
}
@@ -151,7 +137,6 @@ is do foo(), 43, 'state sub falling out of scope (called via amper)';
package bar;
is sb2, 44, 'state sub visible inside itself after decl';
is &sb2, 44, 'state sub visible inside itself after decl (amper)';
- is do sb2(), 44, 'state sub visible inside itself after decl (do)';
}
44
}
@@ -187,9 +172,6 @@ sub sc { 43 }
eval{&sc};
like $@, qr/^Undefined subroutine &sc called at /,
'state sub foo; makes no lex alias for existing sub (amper)';
- eval{do sc()};
- like $@, qr/^Undefined subroutine &sc called at /,
- 'state sub foo; makes no lex alias for existing sub (do)';
}
package main;
{
@@ -339,23 +321,19 @@ like runperl(
isnt \&::foo, \&foo, 'my sub is not stored in the package';
is foo, 44, 'calling my sub from same package';
is &foo, 44, 'calling my sub from same package (amper)';
- is do foo(), 44, 'calling my sub from same package (do)';
package bar;
is foo, 44, 'calling my sub from another package';
is &foo, 44, 'calling my sub from another package (amper)';
- is do foo(), 44, 'calling my sub from another package (do)';
}
package bar;
is foo, 43, 'my sub falling out of scope';
is &foo, 43, 'my sub falling out of scope (called via amper)';
-is do foo(), 43, 'my sub falling out of scope (called via amper)';
{
sub ma { 43 }
my sub ma {
if (shift) {
is ma, 43, 'my sub invisible inside itself';
is &ma, 43, 'my sub invisible inside itself (called via amper)';
- is do ma(), 43, 'my sub invisible inside itself (called via do)';
}
44
}
@@ -372,9 +350,6 @@ is do foo(), 43, 'my sub falling out of scope (called via amper)';
eval{&mb};
like $@, qr/^Undefined subroutine &mb called at /,
'my sub foo {} after forward declaration (amper)';
- eval{do mb()};
- like $@, qr/^Undefined subroutine &mb called at /,
- 'my sub foo {} after forward declaration (do)';
}
44
}
@@ -386,7 +361,6 @@ is do foo(), 43, 'my sub falling out of scope (called via amper)';
package bar;
is mb2, 44, 'my sub visible inside itself after decl';
is &mb2, 44, 'my sub visible inside itself after decl (amper)';
- is do mb2(), 44, 'my sub visible inside itself after decl (do)';
}
44
}
@@ -422,9 +396,6 @@ sub mc { 43 }
eval{&mc};
like $@, qr/^Undefined subroutine &mc called at /,
'my sub foo; makes no lex alias for existing sub (amper)';
- eval{do mc()};
- like $@, qr/^Undefined subroutine &mc called at /,
- 'my sub foo; makes no lex alias for existing sub (do)';
}
package main;
{