whitespace cleanup
[gitmo/Class-C3-XS.git] / t / 04_MRO.t
1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5
6 use Test::More tests => 1;
7
8 use Class::C3::XS;
9
10 =pod
11
12 example taken from: L<http://gauss.gwydiondylan.org/books/drm/drm_50.html>
13
14          Object
15            ^
16            |
17         LifeForm
18          ^    ^
19         /      \
20    Sentient    BiPedal
21       ^          ^
22       |          |
23  Intelligent  Humanoid
24        ^        ^
25         \      /
26          Vulcan
27
28  define class <sentient> (<life-form>) end class;
29  define class <bipedal> (<life-form>) end class;
30  define class <intelligent> (<sentient>) end class;
31  define class <humanoid> (<bipedal>) end class;
32  define class <vulcan> (<intelligent>, <humanoid>) end class;
33
34 =cut
35
36 {
37     package Object;
38     our @ISA = qw//;
39
40     package LifeForm;
41     use base 'Object';
42
43     package Sentient;
44     use base 'LifeForm';
45
46     package BiPedal;
47     use base 'LifeForm';
48
49     package Intelligent;
50     use base 'Sentient';
51
52     package Humanoid;
53     use base 'BiPedal';
54
55     package Vulcan;
56     use base ('Intelligent', 'Humanoid');
57 }
58
59 is_deeply(
60     [ Class::C3::XS::calculateMRO('Vulcan') ],
61     [ qw(Vulcan Intelligent Sentient Humanoid BiPedal LifeForm Object) ],
62     '... got the right MRO for the Vulcan Dylan Example');