6 use Test::More tests => 15;
16 Level 3 | O | (more general)
22 Level 2 3 | D | 4| E | | F | 5 |
28 Level 1 1 | B | | C | 2 |
33 Level 0 0 | A | (more specialized)
50 sub C_or_E { 'Test::E' }
56 sub C_or_D { 'Test::D' }
59 use base ('Test::D', 'Test::F');
62 sub C_or_D { 'Test::C' }
63 sub C_or_E { 'Test::C' }
67 use base ('Test::D', 'Test::E');
70 use base ('Test::B', 'Test::C');
75 [ Class::C3::calculateMRO('Test::F') ],
76 [ qw(Test::F Test::O) ],
77 '... got the right MRO for Test::F');
80 [ Class::C3::calculateMRO('Test::E') ],
81 [ qw(Test::E Test::O) ],
82 '... got the right MRO for Test::E');
85 [ Class::C3::calculateMRO('Test::D') ],
86 [ qw(Test::D Test::O) ],
87 '... got the right MRO for Test::D');
90 [ Class::C3::calculateMRO('Test::C') ],
91 [ qw(Test::C Test::D Test::F Test::O) ],
92 '... got the right MRO for Test::C');
95 [ Class::C3::calculateMRO('Test::B') ],
96 [ qw(Test::B Test::D Test::E Test::O) ],
97 '... got the right MRO for Test::B');
100 [ Class::C3::calculateMRO('Test::A') ],
101 [ qw(Test::A Test::B Test::C Test::D Test::E Test::F Test::O) ],
102 '... got the right MRO for Test::A');
104 is(Test::A->C_or_D, 'Test::C', '... got the expected method output');
105 is(Test::A->can('C_or_D')->(), 'Test::C', '... can got the expected method output');
107 is(Test::B->C_or_D, 'Test::D', '... got the expected method output');
108 is(Test::B->can('C_or_D')->(), 'Test::D', '... can got the expected method output');
110 is(Test::A->C_or_E, 'Test::C', '... got the expected method output');
111 is(Test::A->can('C_or_E')->(), 'Test::C', '... can got the expected method output');
113 is(Test::B->C_or_E, 'Test::E', '... got the expected method output');
114 is(Test::B->can('C_or_E')->(), 'Test::E', '... can got the expected method output');