This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #122107] test that BEGIN blocks with errors don't remain named subs
authorTony Cook <tony@develop-help.com>
Thu, 10 Jul 2014 01:37:39 +0000 (11:37 +1000)
committerTony Cook <tony@develop-help.com>
Sun, 10 Aug 2014 23:31:59 +0000 (09:31 +1000)
t/op/sub.t

index 7df8f49..0e4ffda 100644 (file)
@@ -6,7 +6,7 @@ BEGIN {
     require './test.pl';
 }
 
     require './test.pl';
 }
 
-plan( tests => 33 );
+plan( tests => 34 );
 
 sub empty_sub {}
 
 
 sub empty_sub {}
 
@@ -222,3 +222,12 @@ ok !exists $INC{"re.pm"}, 're.pm not loaded yet';
     is $str[1], $str[0],
       'Pure-Perl sub clobbering sub whose DESTROY assigns to the glob';
 }
     is $str[1], $str[0],
       'Pure-Perl sub clobbering sub whose DESTROY assigns to the glob';
 }
+
+{ local $TODO = "fixed in next commit";
+# [perl #122107] previously this would return
+#  Subroutine BEGIN redefined at (eval 2) line 2.
+fresh_perl_is(<<'EOS', "", { stderr => 1 },
+use strict; use warnings; eval q/use File::{Spec}/; eval q/use File::Spec/;
+EOS
+              "check special blocks are cleared on error");
+}