summaryrefslogtreecommitdiff
path: root/t/op/write.t
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2012-08-17 14:24:05 -0700
committerFather Chrysostomos <sprout@cpan.org>2012-08-17 16:45:22 -0700
commit7c93c29bad5a630df394ef899b8f995cc29154c8 (patch)
tree49c8a226ec7c9247f157fd73d187dff3a5a1c47b /t/op/write.t
parent84eea98055f218b655619db1600f75f511c33e3d (diff)
downloadperl-7c93c29bad5a630df394ef899b8f995cc29154c8.tar.gz
Don’t leak formats defined inside subs
I made them leak inadvertently in 5.17.2 with commit e09ac076a1da. This was unfortunately backported to 5.16.1 (as 3149499832) without anybody noticing the bug.
Diffstat (limited to 't/op/write.t')
-rw-r--r--t/op/write.t14
1 files changed, 13 insertions, 1 deletions
diff --git a/t/op/write.t b/t/op/write.t
index 5706e49889..3fafc204ae 100644
--- a/t/op/write.t
+++ b/t/op/write.t
@@ -61,7 +61,7 @@ for my $tref ( @NumTests ){
my $bas_tests = 21;
# number of tests in section 3
-my $bug_tests = 8 + 3 * 3 * 5 * 2 * 3 + 2 + 66 + 4 + 2 + 3 + 96 + 10;
+my $bug_tests = 8 + 3 * 3 * 5 * 2 * 3 + 2 + 66 + 4 + 2 + 3 + 96 + 11;
# number of tests in section 4
my $hmb_tests = 35;
@@ -1102,6 +1102,18 @@ write STRICT;
close STRICT or die "Could not close: $!";
is cat('Op_write.tmp'), "oof:\n", 'pragmata on format line';
+SKIP: {
+ skip "no weak refs" unless eval { require Scalar::Util };
+ sub Potshriggley {
+format Potshriggley =
+.
+ }
+ Scalar::Util::weaken(my $x = *Potshriggley{FORMAT});
+ undef *Potshriggley;
+ is $x, undef, 'formats in subs do not leak';
+ use Devel::Peek; Dump $x if $x;
+}
+
#############################
## Section 4