summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorDave Mitchell <davem@fdisolutions.com>2006-12-29 00:08:35 +0000
committerDave Mitchell <davem@fdisolutions.com>2006-12-29 00:08:35 +0000
commit7e5d8ed22a9e0983529873e07602c1b147b8b5b8 (patch)
tree4c7e2c13fcea923635ea9c6d9fbb45471e33ba95 /t
parent44a10c71f5d5adc63a15c1d8fb5e8b72de48836f (diff)
downloadperl-7e5d8ed22a9e0983529873e07602c1b147b8b5b8.tar.gz
further fix for #29543: fix parser leaks caused by croaking
p4raw-id: //depot/perl@29636
Diffstat (limited to 't')
-rw-r--r--t/comp/parser.t26
1 files changed, 25 insertions, 1 deletions
diff --git a/t/comp/parser.t b/t/comp/parser.t
index ddbb7608e6..4895d06564 100644
--- a/t/comp/parser.t
+++ b/t/comp/parser.t
@@ -9,7 +9,7 @@ BEGIN {
}
BEGIN { require "./test.pl"; }
-plan( tests => 65 );
+plan( tests => 72 );
eval '%@x=0;';
like( $@, qr/^Can't modify hash dereference in repeat \(x\)/, '%@x=0' );
@@ -251,3 +251,27 @@ eval q[
like($@, qr/Can't modify/, 'croak cleanup 3' );
+# these might leak, or have duplicate frees, depending on the bugginess of
+# the parser stack 'fail in reduce' cleanup code. They're here mainly as
+# something to be run under valgrind, with PERL_DESTRUCT_LEVEL=1.
+
+eval q[ BEGIN { } ] for 1..10;
+is($@, "", 'BEGIN 1' );
+
+eval q[ BEGIN { my $x; $x = 1 } ] for 1..10;
+is($@, "", 'BEGIN 2' );
+
+eval q[ BEGIN { \&foo1 } ] for 1..10;
+is($@, "", 'BEGIN 3' );
+
+eval q[ sub foo2 { } ] for 1..10;
+is($@, "", 'BEGIN 4' );
+
+eval q[ sub foo3 { my $x; $x=1 } ] for 1..10;
+is($@, "", 'BEGIN 5' );
+
+eval q[ BEGIN { die } ] for 1..10;
+like($@, qr/BEGIN failed--compilation aborted/, 'BEGIN 6' );
+
+eval q[ BEGIN {\&foo4; die } ] for 1..10;
+like($@, qr/BEGIN failed--compilation aborted/, 'BEGIN 7' );