X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fisa.t;h=f2e516fc1328207a34d994edd1466185731573f3;hb=672ffdba4da7d100f0377139c087ea63c0f24ecd;hp=ce852a661116edc37e8464568a54712949dd2f5f;hpb=fe08abc6ffcbbc3f827fe53ed99c9868e2d2bc7b;p=gitmo%2FPackage-Stash-XS.git diff --git a/t/isa.t b/t/isa.t index ce852a6..f2e516f 100644 --- a/t/isa.t +++ b/t/isa.t @@ -12,11 +12,38 @@ use Package::Stash; { package Bar; + sub bar { } } -my $stash = Package::Stash->new('Foo'); -my @ISA = ('Bar'); -@{$stash->get_or_add_symbol('@ISA')} = @ISA; -isa_ok('Foo', 'Bar'); +{ + my $stash = Package::Stash->new('Foo'); + my @ISA = ('Bar'); + @{$stash->get_or_add_symbol('@ISA')} = @ISA; + isa_ok('Foo', 'Bar'); + isa_ok(bless({}, 'Foo'), 'Bar'); +} + +{ + package Baz; + sub foo { } +} + +{ + my $stash = Package::Stash->new('Quux'); + { + my $isa = $stash->get_or_add_symbol('@ISA'); + @$isa = ('Baz'); + isa_ok('Quux', 'Baz'); + isa_ok(bless({}, 'Quux'), 'Baz'); + ok(Quux->can('foo')); + } + { + my $isa = $stash->get_or_add_symbol('@ISA'); + @$isa = ('Bar'); + isa_ok('Quux', 'Bar'); + isa_ok(bless({}, 'Quux'), 'Bar'); + ok(Quux->can('bar')); + } +} done_testing;