From: Gerard Goossen Date: Wed, 9 Dec 2009 16:23:00 +0000 (+0100) Subject: Add a test that "eval" does not create additional reference to ouside variables. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=3b9d46a33410a9102d17c3c7c166c3b2dbd93060;p=p5sagit%2Fp5-mst-13.2.git Add a test that "eval" does not create additional reference to ouside variables. --- diff --git a/t/op/eval.t b/t/op/eval.t index 58a6334..305d7f3 100644 --- a/t/op/eval.t +++ b/t/op/eval.t @@ -6,7 +6,7 @@ BEGIN { require './test.pl'; } -print "1..103\n"; +print "1..105\n"; eval 'print "ok 1\n";'; @@ -560,6 +560,15 @@ $test++; curr_test($test); +{ + # test that the CV compiled for the eval is freed by checking that no additional + # reference to outside lexicals are made. + my $x; + is(Internals::SvREFCNT($x), 1, "originally only 1 referece"); + eval '$x'; + is(Internals::SvREFCNT($x), 1, "execution eval doesn't create new references"); +} + fresh_perl_is(<<'EOP', "ok\n", undef, 'RT #70862'); $::{'@'}=''; eval {};