diff options
author | Nicholas Clark <nick@ccl4.org> | 2010-07-12 11:56:59 +0100 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2010-07-12 13:43:19 +0100 |
commit | 0d7caf4cc74eb29a95f71af5a91fef30ca848e41 (patch) | |
tree | 7f573fd94084d95d1ce1616c09d0ec7c282affc3 /t/op | |
parent | 79d2d448469df7917fb728ca8a674f771610599c (diff) | |
download | perl-0d7caf4cc74eb29a95f71af5a91fef30ca848e41.tar.gz |
Perl_sv_pos_b2u now calls utf8_mg_len_cache_update for the string end offset.
Previously it would not take special action if the offset requested happened to
be the end of the string, meaning that the (fixed size) UTF-8 offset cache
would be used for a value which could (and should) be stored elsewhere.
Diffstat (limited to 't/op')
-rw-r--r-- | t/op/pos.t | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/t/op/pos.t b/t/op/pos.t index c3abfbe387..04263e1017 100644 --- a/t/op/pos.t +++ b/t/op/pos.t @@ -6,7 +6,7 @@ BEGIN { require './test.pl'; } -plan tests => 6; +plan tests => 7; $x='banana'; $x=~/.a/g; @@ -28,3 +28,11 @@ $x = "123 56"; $x =~ / /g; is(pos($x), 4); { local $x } is(pos($x), 4); + +# Explict test that triggers the utf8_mg_len_cache_update() code path in +# Perl_sv_pos_b2u(). + +$x = "\x{100}BC"; +$x =~ m/.*/g; +is(pos $x, 3); + |