From cf203c62f1150b565f11422be478d513ad57902b Mon Sep 17 00:00:00 2001 From: Florian Ragwitz Date: Wed, 8 Sep 2010 05:03:23 +0200 Subject: Move test for #76540 to op/gv.t Commit e5c69c9b added the test to dist/constant/t/constant.t, probably because the bug was initially reported in combination with constant.pm. However, it was a core bug in gv_init and can be reproduced easily without constant.pm. With this change dist/constant can be safely synced back to CPAN without having to SKIP or TODO this particular test. --- dist/constant/t/constant.t | 15 +-------------- t/op/gv.t | 20 +++++++++++++++++++- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/dist/constant/t/constant.t b/dist/constant/t/constant.t index 793ac0a72d..85a9355a19 100644 --- a/dist/constant/t/constant.t +++ b/dist/constant/t/constant.t @@ -9,7 +9,7 @@ END { @warnings && print STDERR join "\n- ", "accumulated warnings:", @warnings use strict; -use Test::More tests => 97; +use Test::More tests => 96; my $TB = Test::More->builder; BEGIN { use_ok('constant'); } @@ -347,16 +347,3 @@ $kloong = 'schlozhauer'; eval 'use constant undef, 5; 1'; like $@, qr/\ACan't use undef as constant name at /; } - -# [perl #76540] -# this caused panics or 'Attempt to free unreferenced scalar' -# (its a compile-time issue, so the die lets us skip the prints) - -eval < 'bar'; -die "made it"; -print FOO, "\n"; -print FOO, "\n"; -EOF -like($@, qr/made it/, "#76540"); - diff --git a/t/op/gv.t b/t/op/gv.t index 13da980365..cc8f205a85 100644 --- a/t/op/gv.t +++ b/t/op/gv.t @@ -12,7 +12,7 @@ BEGIN { use warnings; require './test.pl'; -plan( tests => 192 ); +plan( tests => 194 ); # type coersion on assignment $foo = 'foo'; @@ -634,6 +634,24 @@ is (scalar $::{fake}, "*main::sym", ); } +# [perl #76540] +# this caused panics or 'Attempt to free unreferenced scalar' +# (its a compile-time issue, so the die lets us skip the prints) +{ + my @warnings; + local $SIG{__WARN__} = sub { push @warnings, @_ }; + + eval <<'EOF'; +BEGIN { $::{FOO} = \'bar' } +die "made it"; +print FOO, "\n"; +print FOO, "\n"; +EOF + + like($@, qr/made it/, "#76540 - no panic"); + ok(!@warnings, "#76540 - no 'Attempt to free unreferenced scalar'"); +} + __END__ Perl Rules -- cgit v1.2.1