| 1 |
#!perl |
| 2 |
|
| 3 |
# Consider two kinds of magic : |
| 4 |
# A : PERL_MAGIC_uvar, with get (but no set) magic |
| 5 |
# B : PERL_MAGIC_ext, with a zero vtbl |
| 6 |
# If those magic are attached on a sv in such a way that the MAGIC chain |
| 7 |
# looks like sv -> B -> A -> NULL (i.e. we first apply A and then B), then |
| 8 |
# mg_magical won't turn SvRMAGICAL on. However, if the chain is in the |
| 9 |
# opposite order (sv -> A -> B -> NULL), SvRMAGICAL used to be turned on. |
| 10 |
|
| 11 |
use strict; |
| 12 |
use warnings; |
| 13 |
|
| 14 |
use Test::More tests => 3; |
| 15 |
|
| 16 |
use_ok('XS::APItest'); |
| 17 |
|
| 18 |
my (%h1, %h2); |
| 19 |
my @f; |
| 20 |
|
| 21 |
rmagical_cast(\%h1, 0); # A |
| 22 |
rmagical_cast(\%h1, 1); # B |
| 23 |
@f = rmagical_flags(\%h1); |
| 24 |
ok(!$f[2], "For sv -> B -> A -> NULL, SvRMAGICAL(sv) is false"); |
| 25 |
|
| 26 |
rmagical_cast(\%h2, 1); # B |
| 27 |
rmagical_cast(\%h2, 0); # A |
| 28 |
@f = rmagical_flags(\%h2); |
| 29 |
ok(!$f[2], "For sv -> A -> B -> NULL, SvRMAGICAL(sv) is false"); |