summaryrefslogtreecommitdiff
path: root/t/pragma/warn/pp_hot
diff options
context:
space:
mode:
Diffstat (limited to 't/pragma/warn/pp_hot')
-rw-r--r--t/pragma/warn/pp_hot48
1 files changed, 45 insertions, 3 deletions
diff --git a/t/pragma/warn/pp_hot b/t/pragma/warn/pp_hot
index 817c0c89d6..60490bcd6a 100644
--- a/t/pragma/warn/pp_hot
+++ b/t/pragma/warn/pp_hot
@@ -37,7 +37,9 @@ __END__
# pp_hot.c
use warning 'unopened' ;
$f = $a = "abc" ;
-print $f $a
+print $f $a;
+no warning 'unopened' ;
+print $f $a;
EXPECT
Filehandle main::abc never opened at - line 4.
########
@@ -50,6 +52,8 @@ open(FOO, ">&STDOUT") and print <FOO>;
print getc(STDERR);
print getc(FOO);
read(FOO,$_,1);
+no warning 'io' ;
+print STDIN "anc";
EXPECT
Filehandle main::STDIN opened only for input at - line 3.
Filehandle main::STDOUT opened only for output at - line 4.
@@ -63,38 +67,50 @@ Filehandle main::FOO opened only for output at - line 9.
use warning 'closed' ;
close STDIN ;
print STDIN "anc";
+no warning 'closed' ;
+print STDIN "anc";
EXPECT
print on closed filehandle main::STDIN at - line 4.
########
# pp_hot.c
use warning 'uninitialized' ;
my $a = undef ;
-my @b = @$a
+my @b = @$a;
+no warning 'uninitialized' ;
+my @c = @$a;
EXPECT
Use of uninitialized value at - line 4.
########
# pp_hot.c
use warning 'uninitialized' ;
my $a = undef ;
-my %b = %$a
+my %b = %$a;
+no warning 'uninitialized' ;
+my %c = %$a;
EXPECT
Use of uninitialized value at - line 4.
########
# pp_hot.c
use warning 'unsafe' ;
my %X ; %X = (1,2,3) ;
+no warning 'unsafe' ;
+my %Y ; %Y = (1,2,3) ;
EXPECT
Odd number of elements in hash assignment at - line 3.
########
# pp_hot.c
use warning 'unsafe' ;
my %X ; %X = [1 .. 3] ;
+no warning 'unsafe' ;
+my %Y ; %Y = [1 .. 3] ;
EXPECT
Reference found where even-sized list expected at - line 3.
########
# pp_hot.c
use warning 'closed' ;
close STDIN ; $a = <STDIN> ;
+no warning 'closed' ;
+$a = <STDIN> ;
EXPECT
Read on closed filehandle main::STDIN at - line 3.
########
@@ -114,6 +130,21 @@ EXPECT
ok
########
# pp_hot.c
+no warning 'recursion' ;
+sub fred
+{
+ fred() if $a++ < 200
+}
+{
+ local $SIG{__WARN__} = sub {
+ die "ok\n" if $_[0] =~ /^Deep recursion on subroutine "main::fred"/
+ };
+ fred();
+}
+EXPECT
+
+########
+# pp_hot.c
use warning 'recursion' ;
$b = sub
{
@@ -123,3 +154,14 @@ $b = sub
&$b ;
EXPECT
Deep recursion on anonymous subroutine at - line 5.
+########
+# pp_hot.c
+no warning 'recursion' ;
+$b = sub
+{
+ &$b if $a++ < 200
+} ;
+
+&$b ;
+EXPECT
+