diff options
author | Jerry D. Hedden <jdhedden@cpan.org> | 2008-07-03 06:02:30 -0400 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2008-07-06 14:12:24 +0000 |
commit | a13351642e6a26cfc620bdb31b15678fd22d224f (patch) | |
tree | 8809b4ae2858b2f5ac8c9cc31bba6ba8c08c8741 /ext/threads/shared/t/utf8.t | |
parent | ab14db95b0de89c4e67326bde2652b72e8b65f0d (diff) | |
download | perl-a13351642e6a26cfc620bdb31b15678fd22d224f.tar.gz |
threads::shared 1.24 (phase 2)
From: "Jerry D. Hedden" <jdhedden@cpan.org>
Message-ID: <1ff86f510807030702q74132e14ne6434876a7138f17@mail.gmail.com>
Additional changes to threads::shared for UTF-8 hash keys.
p4raw-id: //depot/perl@34102
Diffstat (limited to 'ext/threads/shared/t/utf8.t')
-rw-r--r-- | ext/threads/shared/t/utf8.t | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/ext/threads/shared/t/utf8.t b/ext/threads/shared/t/utf8.t index f2e0ac3c77..42e7c3f414 100644 --- a/ext/threads/shared/t/utf8.t +++ b/ext/threads/shared/t/utf8.t @@ -51,42 +51,47 @@ binmode STDOUT, ":utf8"; my $plain = 'foo'; my $utf8 = "\x{123}\x{84}\x{20F}\x{2C1}"; +my $code = \&is; my %a :shared; $a{$plain} = $plain; $a{$utf8} = $utf8; -$a{\&is} = 'code'; +$a{$code} = 'code'; is(exists($a{$plain}), 1, 'Found plain key in shared hash'); is(exists($a{$utf8}), 1, 'Found UTF-8 key in shared hash'); -is(exists($a{\&is}), 1, 'Found code ref key in shared hash'); +is(exists($a{$code}), 1, 'Found code ref key in shared hash'); while (my ($key, $value) = each (%a)) { if ($key eq $plain) { is($key, $plain, 'Plain key in shared hash'); } elsif ($key eq $utf8) { is($key, $utf8, 'UTF-8 key in shared hash'); + } elsif ($key eq "$code") { + is($key, "$code", 'Code ref key in shared hash'); } else { - is($key, \&is, 'Code ref key in shared hash'); + is($key, "???", 'Bad key'); } } my $a = &share({}); $$a{$plain} = $plain; $$a{$utf8} = $utf8; -$$a{\&is} = 'code'; +$$a{$code} = 'code'; is(exists($$a{$plain}), 1, 'Found plain key in shared hash ref'); is(exists($$a{$utf8}), 1, 'Found UTF-8 key in shared hash ref'); -is(exists($$a{\&is}), 1, 'Found code ref key in shared hash ref'); +is(exists($$a{$code}), 1, 'Found code ref key in shared hash ref'); while (my ($key, $value) = each (%$a)) { if ($key eq $plain) { is($key, $plain, 'Plain key in shared hash ref'); } elsif ($key eq $utf8) { is($key, $utf8, 'UTF-8 key in shared hash ref'); + } elsif ($key eq "$code") { + is($key, "$code", 'Code ref key in shared hash ref'); } else { - is($key, \&is, 'Code ref key in shared hash ref'); + is($key, "???", 'Bad key'); } } |