diff options
author | Dave Mitchell <davem@fdisolutions.com> | 2004-01-01 19:58:08 +0000 |
---|---|---|
committer | Dave Mitchell <davem@fdisolutions.com> | 2004-01-01 19:58:08 +0000 |
commit | 53c33732a73c90e26f613c11afdc5110e6a919ff (patch) | |
tree | 0bfba23460f9a96ec7f56d3b170c62a2f386d2dd /ext/threads | |
parent | cc8040a133daf622c9005eb6ffea6375088dc5e7 (diff) | |
download | perl-53c33732a73c90e26f613c11afdc5110e6a919ff.tar.gz |
Fix bug #24383, where hashes with the :unique attribute weren't
getting made readonly on interpreter clone. Also, remove the
:unique attribute from the hashes in warnings.pm, since they may
later be modified by warnings::register. Finally, adds tests for
the :unique attribute.
p4raw-id: //depot/perl@22034
Diffstat (limited to 'ext/threads')
-rw-r--r-- | ext/threads/t/problems.t | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/ext/threads/t/problems.t b/ext/threads/t/problems.t index b860ff5e1d..b2b78dfe40 100644 --- a/ext/threads/t/problems.t +++ b/ext/threads/t/problems.t @@ -18,7 +18,7 @@ use threads::shared; # call is() from within the DESTROY() function at global destruction time, # and parts of Test::* may have already been freed by then -print "1..5\n"; +print "1..8\n"; my $test : shared = 1; @@ -73,4 +73,24 @@ my $not = eval { Config::myconfig() } ? '' : 'not '; print "${not}ok $test - Are we able to call Config::myconfig after clone\n"; $test++; +# bugid 24383 - :unique hashes weren't being made readonly on interpreter +# clone; check that they are. + +our $unique_scalar : unique; +our @unique_array : unique; +our %unique_hash : unique; +threads->new( + sub { + eval { $unique_scalar = 1 }; + print $@ =~ /read-only/ ? '' : 'not ', "ok $test - unique_scalar\n"; + $test++; + eval { $unique_array[0] = 1 }; + print $@ =~ /read-only/ ? '' : 'not ', "ok $test - unique_array\n"; + $test++; + eval { $unique_hash{abc} = 1 }; + print $@ =~ /disallowed/ ? '' : 'not ', "ok $test - unique_hash\n"; + $test++; + } +)->join; + 1; |