diff options
author | Tony Cook <tony@develop-help.com> | 2016-01-26 15:22:46 +1100 |
---|---|---|
committer | Tony Cook <tony@develop-help.com> | 2016-02-02 16:16:53 +1100 |
commit | 23895cdc3161aed8a5516d7d1245ddc5b67ddc6b (patch) | |
tree | 430e066abf9600f08e25e0da432fbf71e2d5930c /t | |
parent | 248ec5921d4dcf7e0bc87ed86231768fd3d0c60d (diff) | |
download | perl-23895cdc3161aed8a5516d7d1245ddc5b67ddc6b.tar.gz |
[perl #127351] TODO tests for arrayref assigned to *Foo::ISA issues
Diffstat (limited to 't')
-rw-r--r-- | t/mro/basic.t | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/t/mro/basic.t b/t/mro/basic.t index d5663f4dfd..f68637a7f9 100644 --- a/t/mro/basic.t +++ b/t/mro/basic.t @@ -9,7 +9,7 @@ BEGIN { use strict; use warnings; -plan(tests => 64); +plan(tests => 66); require mro; @@ -433,3 +433,37 @@ delete $Bar::{ISA}; print "ok\n"; PROG } + +{ + # [perl #127351] + local $::TODO = "assignment to *Foo::ISA doesn't magicalize elements"; + # *Foo::ISA = \@some_array + # didn't magicalize the elements of @some_array, causing two + # problems: + + # a) assignment to those elements didn't update the cache + + fresh_perl_is(<<'PROG', "foo\nother", {}, "magical *ISA = arrayref elements"); +*My::Parent::foo = sub { "foo" }; +*My::OtherParent::foo = sub { "other" }; +my $x = [ "My::Parent" ]; +*Fake::ISA = $x; +print Fake->foo, "\n"; +$x->[0] = "My::OtherParent"; +print Fake->foo, "\n"; +PROG + + # b) code that attempted to remove the magic when @some_array + # was no longer an @ISA asserted/crashed + + fresh_perl_is(<<'PROG', "foo", {}, "unmagicalize *ISA elements"); +{ + local *My::Parent::foo = sub { "foo" }; + my $x = [ "My::Parent" ]; + *Fake::ISA = $x; + print Fake->foo, "\n"; + my $s = \%Fake::; + delete $s->{ISA}; +} +PROG +} |