summaryrefslogtreecommitdiff
path: root/t/lib/warnings/pad
diff options
context:
space:
mode:
Diffstat (limited to 't/lib/warnings/pad')
-rw-r--r--t/lib/warnings/pad83
1 files changed, 74 insertions, 9 deletions
diff --git a/t/lib/warnings/pad b/t/lib/warnings/pad
index 7dd28762f1..71f683ed54 100644
--- a/t/lib/warnings/pad
+++ b/t/lib/warnings/pad
@@ -4,21 +4,21 @@
my $x;
my $x ;
- Variable "%s" may be unavailable
+ Variable "%s" will not stay shared
sub x {
my $x;
sub y {
- $x
+ sub { $x }
}
}
- Variable "%s" will not stay shared
sub x {
my $x;
sub y {
- sub { $x }
+ $x
}
}
+
"our" variable %s redeclared (Did you mean "local" instead of "our"?)
our $x;
{
@@ -65,24 +65,89 @@ EXPECT
# pad.c
use warnings 'closure' ;
sub x {
- our $x;
+ my $x;
sub y {
- $x
+ sub { $x }
}
}
EXPECT
+Variable "$x" will not stay shared at - line 6.
+########
+# pad.c
+use warnings 'closure' ;
+sub x {
+ my $x;
+ sub {
+ $x;
+ sub y {
+ $x
+ }
+ }->();
+}
+EXPECT
+Variable "$x" will not stay shared at - line 9.
+########
+# pad.c
+use warnings 'closure' ;
+my $x;
+sub {
+ $x;
+ sub f {
+ sub { $x }->();
+ }
+}->();
+EXPECT
########
# pad.c
use warnings 'closure' ;
+sub {
+ my $x;
+ sub f { $x }
+}->();
+EXPECT
+Variable "$x" is not available at - line 5.
+########
+# pad.c
+use warnings 'closure' ;
+sub {
+ my $x;
+ eval 'sub f { $x }';
+}->();
+EXPECT
+
+########
+# pad.c
+use warnings 'closure' ;
+sub {
+ my $x;
+ sub f { eval '$x' }
+}->();
+f();
+EXPECT
+Variable "$x" is not available at (eval 1) line 2.
+########
+# pad.c
+use warnings 'closure' ;
sub x {
- my $x;
+ our $x;
sub y {
- sub { $x }
+ $x
}
}
EXPECT
-Variable "$x" may be unavailable at - line 6.
+
+########
+# pad.c
+# see bugid 1754
+use warnings 'closure' ;
+sub f {
+ my $x;
+ sub { eval '$x' };
+}
+f()->();
+EXPECT
+Variable "$x" is not available at (eval 1) line 2.
########
# pad.c
no warnings 'closure' ;