diff options
Diffstat (limited to 't/op/utf8magic.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; |