1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
#!perl -w
BEGIN {
chdir 't' if -d 't';
@INC = '../lib';
require "./test.pl";
}
use strict;
plan 'no_plan';
# package klonk doesn't have a stash.
package kapow;
# No parents
package urkkk;
# 1 parent
@urkkk::ISA = 'klonk';
package kayo;
# 2 parents
@urkkk::ISA = ('klonk', 'kapow');
package thwacke;
# No parents, has @ISA
@thwacke::ISA = ();
package zzzzzwap;
@zzzzzwap::ISA = ('thwacke', 'kapow');
package whamm;
@whamm::ISA = ('kapow', 'thwacke');
package main;
require mro;
my %expect =
(
klonk => [qw(klonk)],
urkkk => [qw(urkkk klonk kapow)],
kapow => [qw(kapow)],
kayo => [qw(kayo)],
thwacke => [qw(thwacke)],
zzzzzwap => [qw(zzzzzwap thwacke kapow)],
whamm => [qw(whamm kapow thwacke)],
);
foreach my $package (qw(klonk urkkk kapow kayo thwacke zzzzzwap whamm)) {
my $ref = bless [], $package;
my $isa = $expect{$package};
is("@{mro::get_linear_isa($package)}", "@$isa", "\@ISA for $package");
foreach my $class ($package, @$isa, 'UNIVERSAL') {
object_ok($ref, $class, $package);
}
}
|