diff options
-rw-r--r-- | MANIFEST | 2 | ||||
-rw-r--r-- | ext/XS-APItest/t/svpv_magic.t | 20 |
2 files changed, 20 insertions, 2 deletions
@@ -4002,7 +4002,7 @@ ext/XS-APItest/t/stuff_modify_bug.t test for eval side-effecting source string ext/XS-APItest/t/stuff_svcur_bug.t test for a bug in lex_stuff_pvn ext/XS-APItest/t/sviscow.t Test SvIsCOW ext/XS-APItest/t/svpeek.t XS::APItest extension -ext/XS-APItest/t/svpv_magic.t Test behaviour of SvPVbyte and get magic +ext/XS-APItest/t/svpv_magic.t Test behaviour of SvPVbyte/utf8 & get magic ext/XS-APItest/t/svpv.t More generic SvPVbyte and SvPVutf8 tests ext/XS-APItest/t/svsetsv.t Test behaviour of sv_setsv with/without PERL_CORE ext/XS-APItest/t/swaplabel.t test recursive descent label parsing diff --git a/ext/XS-APItest/t/svpv_magic.t b/ext/XS-APItest/t/svpv_magic.t index 2ea6941abd..766c420349 100644 --- a/ext/XS-APItest/t/svpv_magic.t +++ b/ext/XS-APItest/t/svpv_magic.t @@ -1,6 +1,6 @@ #!perl -w -use Test::More tests => 5; +use Test::More tests => 9; BEGIN { use_ok('XS::APItest') @@ -28,3 +28,21 @@ $b =~ /(.)/; # $1 shouldn't have the utf8 flag anymore is(eval { XS::APItest::first_byte($1) } || $@, 0303, "utf8 flag fetched correctly without stringification"); + +sub TIESCALAR { bless [], shift } +sub FETCH { ++$f; *{chr 255} } +tie $t, "main"; +is SvPVutf8($t), "*main::\xc3\xbf", + 'SvPVutf8 works with get-magic changing the SV type'; +is $f, 1, 'SvPVutf8 calls get-magic once'; + +package t { + @ISA = 'main'; + sub FETCH { ++$::f; chr 255 } + sub STORE { } +} +tie $t, "t"; +undef $f; +is SvPVutf8($t), "\xc3\xbf", + 'SvPVutf8 works with get-magic upgrading the SV'; +is $f, 1, 'SvPVutf8 calls get-magic once'; |