This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix utf8::is_utf8 to respect GMAGIC (e.g. $1)
[perl5.git] / t / op / utf8magic.t
CommitLineData
76f73021 1#!perl -w
2use strict;
3use Test::More;
4
5my $str = "\x{99f1}\x{99dd}"; # "camel" in Japanese kanji
6$str =~ /(.)/;
7
8ok utf8::is_utf8($1), "is_utf8(unistr)";
9scalar "$1"; # invoke SvGETMAGIC
10ok utf8::is_utf8($1), "is_utf8(unistr)";
11
12utf8::encode($str); # off the utf8 flag
13$str =~ /(.)/;
14
15ok !utf8::is_utf8($1), "is_utf8(bytes)";
16scalar "$1"; # invoke SvGETMAGIC
17ok !utf8::is_utf8($1), "is_utf8(bytes)";
18
19done_testing;