diff options
author | Father Chrysostomos <sprout@cpan.org> | 2012-01-31 13:04:57 -0800 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2012-01-31 13:15:39 -0800 |
commit | 4b0b99d26e495000677c5746dcab488fac511396 (patch) | |
tree | f2653c661b4d3027e5dae76d3047855bcc545b1e /ext/XS-APItest | |
parent | fe46cbda823c09f80e4bc48dd93fafb26cc805f6 (diff) | |
download | perl-4b0b99d26e495000677c5746dcab488fac511396.tar.gz |
Test that SvPVutf8 works with magic vars
It didn’t until the previous commit.
Diffstat (limited to 'ext/XS-APItest')
-rw-r--r-- | ext/XS-APItest/t/svpv_magic.t | 20 |
1 files changed, 19 insertions, 1 deletions
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'; |