diff options
author | gfx <gfuji@cpan.org> | 2010-04-25 22:02:09 +0200 |
---|---|---|
committer | Rafael Garcia-Suarez <rgs@consttype.org> | 2010-04-25 22:02:09 +0200 |
commit | 76f730215a330c9eedad075cf13e470e97f62846 (patch) | |
tree | c803d1e6682bedca0691094abce5a70093de46db /t | |
parent | 39cf747a86645fde6898cd6d09d351d50755c2fa (diff) | |
download | perl-76f730215a330c9eedad075cf13e470e97f62846.tar.gz |
Fix utf8::is_utf8 to respect GMAGIC (e.g. $1)
Diffstat (limited to 't')
-rw-r--r-- | t/op/utf8magic.t | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/t/op/utf8magic.t b/t/op/utf8magic.t new file mode 100644 index 0000000000..2c915b716e --- /dev/null +++ b/t/op/utf8magic.t @@ -0,0 +1,19 @@ +#!perl -w +use strict; +use Test::More; + +my $str = "\x{99f1}\x{99dd}"; # "camel" in Japanese kanji +$str =~ /(.)/; + +ok utf8::is_utf8($1), "is_utf8(unistr)"; +scalar "$1"; # invoke SvGETMAGIC +ok utf8::is_utf8($1), "is_utf8(unistr)"; + +utf8::encode($str); # off the utf8 flag +$str =~ /(.)/; + +ok !utf8::is_utf8($1), "is_utf8(bytes)"; +scalar "$1"; # invoke SvGETMAGIC +ok !utf8::is_utf8($1), "is_utf8(bytes)"; + +done_testing; |