summaryrefslogtreecommitdiff
path: root/t/op
diff options
context:
space:
mode:
Diffstat (limited to 't/op')
-rw-r--r--t/op/hash.t15
1 files changed, 14 insertions, 1 deletions
diff --git a/t/op/hash.t b/t/op/hash.t
index b8aeaa7d2e..34bfcde350 100644
--- a/t/op/hash.t
+++ b/t/op/hash.t
@@ -8,7 +8,7 @@ BEGIN {
use strict;
-plan tests => 10;
+plan tests => 11;
my %h;
@@ -168,3 +168,16 @@ is($destroyed, 1, 'Timely hash destruction with lvalue keys');
delete $h{k}; # must be in void context to trigger the bug
ok $normal_exit, 'freed hash elems are not visible to DESTROY';
}
+
+# Weak references to pad hashes
+{
+ skip_if_miniperl("No Scalar::Util::weaken under miniperl", 1);
+ my $ref;
+ require Scalar::Util;
+ {
+ my %hash;
+ Scalar::Util::weaken($ref = \%hash);
+ 1; # the previous statement must not be the last
+ }
+ is $ref, undef, 'weak refs to pad hashes go stale on scope exit';
+}