1use strict;
2use warnings;
3use lib 't/lib';
4use Test::More;
5
6use Package::Stash;
7
8{
9    package Foo;
10}
11
12{
13    package Bar;
14    sub bar { }
15}
16
17{
18    my $stash = Package::Stash->new('Foo');
19    my @ISA = ('Bar');
20    @{$stash->get_or_add_symbol('@ISA')} = @ISA;
21    isa_ok('Foo', 'Bar');
22    isa_ok(bless({}, 'Foo'), 'Bar');
23}
24
25{
26    package Baz;
27    sub foo { }
28}
29
30{
31    my $stash = Package::Stash->new('Quux');
32    {
33        my $isa = $stash->get_or_add_symbol('@ISA');
34        @$isa = ('Baz');
35        isa_ok('Quux', 'Baz');
36        isa_ok(bless({}, 'Quux'), 'Baz');
37        ok(Quux->can('foo'));
38    }
39    {
40        my $isa = $stash->get_or_add_symbol('@ISA');
41        @$isa = ('Bar');
42        isa_ok('Quux', 'Bar');
43        isa_ok(bless({}, 'Quux'), 'Bar');
44        ok(Quux->can('bar'));
45    }
46}
47
48done_testing;
49