summaryrefslogtreecommitdiff
path: root/ext/Storable
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2004-02-27 10:41:39 +0000
committerNicholas Clark <nick@ccl4.org>2004-02-27 10:41:39 +0000
commit18026298eff2588a08fb9adea03ddb6fd64c650b (patch)
treee73d690ec4ac34a8e58cb899eff28f0e5c1a15e1 /ext/Storable
parent213ce8b3ce4d3f5793ccaac359c1025cb843f91b (diff)
downloadperl-18026298eff2588a08fb9adea03ddb6fd64c650b.tar.gz
In hsplit, if a normal hash has placeholders then clear them before
splitting. We can do this safely because Storable ensures hsplit is not called while it builds restricted hashes (actually any hashes) This change may not make things faster, but now we have the choice. p4raw-id: //depot/perl@22393
Diffstat (limited to 'ext/Storable')
-rw-r--r--ext/Storable/t/restrict.t21
1 files changed, 20 insertions, 1 deletions
diff --git a/ext/Storable/t/restrict.t b/ext/Storable/t/restrict.t
index 9359f216d6..58c10042c6 100644
--- a/ext/Storable/t/restrict.t
+++ b/ext/Storable/t/restrict.t
@@ -38,7 +38,7 @@ sub BEGIN {
use Storable qw(dclone);
use Hash::Util qw(lock_hash unlock_value);
-print "1..16\n";
+print "1..50\n";
my %hash = (question => '?', answer => 42, extra => 'junk', undef => undef);
lock_hash %hash;
@@ -100,4 +100,23 @@ for $Storable::canonical (0, 1) {
testit (\%hash);
my $object = \%hash;
# bless {}, "Restrict_Test";
+
+ my %hash2;
+ $hash2{"k$_"} = "v$_" for 0..16;
+ lock_hash %hash2;
+ for (0..16) {
+ unlock_value %hash2, "k$_";
+ delete $hash2{"k$_"};
+ }
+ my $copy = dclone \%hash2;
+
+ for (0..16) {
+ my $k = "k$_";
+ eval { $copy->{$k} = undef } ;
+ unless (ok ++$test, !$@, "Can assign to reserved key '$k'?") {
+ my $diag = $@;
+ $diag =~ s/\n.*\z//s;
+ print "# \$\@: $diag\n";
+ }
+ }
}