diff options
author | Nicholas Clark <nick@ccl4.org> | 2006-05-28 10:40:48 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2006-05-28 10:40:48 +0000 |
commit | 9f76984545c78a615ef3f2522fb5b77578e41023 (patch) | |
tree | 887de5508973ef722c2714e691af75d638f19430 /t | |
parent | eb7d7d25d2f780edcbedc124a5bdca0d53ad8687 (diff) | |
download | perl-9f76984545c78a615ef3f2522fb5b77578e41023.tar.gz |
Perl_refcounted_he_chain_2hv()'s code to skip duplicate keys was far
too lax.
p4raw-id: //depot/perl@28320
Diffstat (limited to 't')
-rw-r--r-- | t/op/caller.t | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/t/op/caller.t b/t/op/caller.t index d0716be4a7..c5bb84ea5d 100644 --- a/t/op/caller.t +++ b/t/op/caller.t @@ -5,7 +5,7 @@ BEGIN { chdir 't' if -d 't'; @INC = '../lib'; require './test.pl'; - plan( tests => 71 ); + plan( tests => 77 ); } my @c; @@ -267,3 +267,27 @@ EOE is(get_hash()->{$k2}, 2, "UTF-8 or not, it's the same"); is(get_hash()->{$k3}, 3, "Octect sequences and UTF-8 are distinct"); } + +{ + my ($k1, $k2, $k3); + BEGIN { + ($k1, $k2, $k3) = ("\0", "\0\0", "\0\0\0"); + $^H{$k1} = 1; + $^H{$k2} = 2; + $^H{$k3} = 3; + } + + is(get_hash()->{$k1}, 1, "Keys with the same hash value don't clash"); + is(get_hash()->{$k2}, 2, "Keys with the same hash value don't clash"); + is(get_hash()->{$k3}, 3, "Keys with the same hash value don't clash"); + + BEGIN { + $^H{$k1} = "a"; + $^H{$k2} = "b"; + $^H{$k3} = "c"; + } + + is(get_hash()->{$k1}, "a", "Keys with the same hash value don't clash"); + is(get_hash()->{$k2}, "b", "Keys with the same hash value don't clash"); + is(get_hash()->{$k3}, "c", "Keys with the same hash value don't clash"); +} |