summaryrefslogtreecommitdiff
path: root/lib/utf8.t
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2011-05-29 20:39:33 -0700
committerFather Chrysostomos <sprout@cpan.org>2011-05-29 20:39:51 -0700
commitb2b7346bfc59caff514d997701e0e086b983c863 (patch)
tree89ae20361692e532f68e1250a49641e730fa9e32 /lib/utf8.t
parent3259388b9b72d07a50fa1de8a5c6c1764a8e7584 (diff)
downloadperl-b2b7346bfc59caff514d997701e0e086b983c863.tar.gz
2nd try: [perl #91834] utf8::decode does not respect copy-on-write
I reverted the first version of this patch because I put the if() statement before a declaration. I did a revert, rather than a correc- tion, to make back-porting easier.
Diffstat (limited to 'lib/utf8.t')
-rw-r--r--lib/utf8.t12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/utf8.t b/lib/utf8.t
index ae81ccdc46..b13bb5377d 100644
--- a/lib/utf8.t
+++ b/lib/utf8.t
@@ -427,6 +427,18 @@ SKIP: {
}
{
+ # Make sure utf8::decode respects copy-on-write [perl #91834].
+ # Hash keys are the easiest way to test this.
+ my $name = "\x{c3}\x{b3}";
+ my ($k1) = keys %{ { $name=>undef } };
+ my $k2 = $name;
+ utf8::decode($k1);
+ utf8::decode($k2);
+ my $h = { $k1 => 1, $k2 => 2 };
+ is join('', keys $h), $k2, 'utf8::decode respects copy-on-write';
+}
+
+{
my $a = "456\xb6";
utf8::upgrade($a);