diff options
author | Nicholas Clark <nick@ccl4.org> | 2009-10-06 09:24:08 +0200 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2009-10-06 09:24:08 +0200 |
commit | ab8be49d36ac8fa0d20103344a61b3e7233fcba4 (patch) | |
tree | 594f5eef4cb6dee48268af079b2b5e1d63b74805 /t/uni | |
parent | 64da3008c02a30fac03c1d2dc01e935495f210f8 (diff) | |
download | perl-ab8be49d36ac8fa0d20103344a61b3e7233fcba4.tar.gz |
Don't attempt UTF-8 cache assertion for SVs with invalid SvPVX() (eg overloaded)
Fixes RT 69422.
However, I'm not actually sure whether we should even be caching the results of
UTF-8 operations on overloading, given that nothing stops overloading returning
a different value every time it's called.
Diffstat (limited to 't/uni')
-rw-r--r-- | t/uni/overload.t | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/t/uni/overload.t b/t/uni/overload.t index e4f4e132ea..d44d1711cf 100644 --- a/t/uni/overload.t +++ b/t/uni/overload.t @@ -7,7 +7,7 @@ BEGIN { } } -use Test::More tests => 208; +use Test::More tests => 215; package UTF8Toggle; use strict; @@ -264,6 +264,27 @@ foreach my $value ("\243", UTF8Toggle->new("\243")) { is (pack ("A/A", $value), pack ("A/A", "\243")); } +foreach my $value ("\243", UTF8Toggle->new("\243")) { + my $v; + $v = substr $value, 0, 1; + is ($v, "\243"); + $v = substr $value, 0, 1; + is ($v, "\243"); + $v = substr $value, 0, 1; + is ($v, "\243"); +} + +{ + package RT69422; + use overload '""' => sub { $_[0]->{data} } +} + +{ + my $text = bless { data => "\x{3075}" }, 'RT69422'; + my $p = substr $text, 0, 1; + is ($p, "\x{3075}"); +} + END { 1 while -f $tmpfile and unlink $tmpfile || die "unlink '$tmpfile': $!"; } |