This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Update Encode to CPAN version 2.78
[perl5.git] / t / mro / isa_aliases.t
CommitLineData
e1603486
FC
1#!./perl
2
a817e89d 3BEGIN { chdir 't' if -d 't'; @INC = '../lib'; require './test.pl' }
e1603486 4
6e1b2de7 5plan 13;
e1603486
FC
6
7@Foogh::ISA = "Bar";
8*Phoogh::ISA = *Foogh::ISA;
9@Foogh::ISA = "Baz";
10
11ok 'Foogh'->isa("Baz"),
12 'isa after another stash has claimed the @ISA via glob assignment';
13ok 'Phoogh'->isa("Baz"),
14 'isa on the stash that claimed the @ISA via glob assignment';
15ok !Foogh->isa("Bar"),
16 '!isa when another stash has claimed the @ISA via glob assignment';
17ok !Phoogh->isa("Bar"),
18 '!isa on the stash that claimed the @ISA via glob assignment';
19
a5dba54a
FC
20@Foogh::ISA = "Bar";
21*Foogh::ISA = ["Baz"];
22
23ok 'Foogh'->isa("Baz"),
24 'isa after glob-to-ref assignment when *ISA is shared';
25ok 'Phoogh'->isa("Baz"),
26 'isa after glob-to-ref assignment on another stash when *ISA is shared';
27ok !Foogh->isa("Bar"),
28 '!isa after glob-to-ref assignment when *ISA is shared';
29ok !Phoogh->isa("Bar"),
30 '!isa after glob-to-ref assignment on another stash when *ISA is shared';
31
e1603486
FC
32@Foo::ISA = "Bar";
33*Phoo::ISA = \@Foo::ISA;
34@Foo::ISA = "Baz";
35
36ok 'Foo'->isa("Baz"),
37 'isa after another stash has claimed the @ISA via ref-to-glob assignment';
38ok 'Phoo'->isa("Baz"),
39 'isa on the stash that claimed the @ISA via ref-to-glob assignment';
40ok !Foo->isa("Bar"),
41 '!isa when another stash has claimed the @ISA via ref-to-glob assignment';
42ok !Phoo->isa("Bar"),
43 '!isa on the stash that claimed the @ISA via ref-to-glob assignment';
6e1b2de7
FC
44
45*Fooo::ISA = *Baro::ISA;
46@Fooo::ISA = "Bazo";
47sub Bazo::ook { "Baz" }
48sub L::ook { "See" }
49Baro->ook;
50local *Fooo::ISA = ["L"];
51is 'Baro'->ook, 'See', 'localised *ISA=$ref assignment';