This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Make source filters work in evalbytes
[perl5.git] / ext / XS-APItest / t / svpv_magic.t
1 #!perl -w
2
3 use Test::More tests => 5;
4
5 BEGIN {
6     use_ok('XS::APItest')
7 };
8
9 $b = "\303\244"; # or encode_utf8("\x{e4}");
10
11 is(XS::APItest::first_byte($b), 0303,
12     "test function first_byte works");
13
14 $b =~ /(.)/;
15 is(XS::APItest::first_byte($1), 0303,
16     "matching works correctly");
17
18 $a = qq[\x{263a}]; # utf8 flag is set
19
20 $a =~ s/(.)/$1/;      # $1 now has the utf8 flag set too
21 $b =~ /(.)/;          # $1 shouldn't have the utf8 flag anymore
22
23 is(XS::APItest::first_byte("$1"), 0303,
24     "utf8 flag in match fetched correctly when stringified first");
25
26 $a =~ s/(.)/$1/;      # $1 now has the utf8 flag set too
27 $b =~ /(.)/;          # $1 shouldn't have the utf8 flag anymore
28
29 is(eval { XS::APItest::first_byte($1) } || $@, 0303,
30     "utf8 flag fetched correctly without stringification");