6 require q(./test.pl); plan(tests => 10);
10 This example is take from: http://www.python.org/2.3/mro.html
24 Level 3 | O | (more general)
30 Level 2 3 | D | 4| E | | F | 5 |
36 Level 1 1 | B | | C | 2 |
41 Level 0 0 | A | (more specialized)
58 sub C_or_E { 'Test::E' }
64 sub C_or_D { 'Test::D' }
67 use base ('Test::D', 'Test::F');
70 sub C_or_D { 'Test::C' }
71 sub C_or_E { 'Test::C' }
75 use base ('Test::D', 'Test::E');
78 use base ('Test::B', 'Test::C');
83 mro::get_linear_isa('Test::F'),
84 [ qw(Test::F Test::O) ]
85 ), '... got the right MRO for Test::F');
88 mro::get_linear_isa('Test::E'),
89 [ qw(Test::E Test::O) ]
90 ), '... got the right MRO for Test::E');
93 mro::get_linear_isa('Test::D'),
94 [ qw(Test::D Test::O) ]
95 ), '... got the right MRO for Test::D');
98 mro::get_linear_isa('Test::C'),
99 [ qw(Test::C Test::D Test::F Test::O) ]
100 ), '... got the right MRO for Test::C');
103 mro::get_linear_isa('Test::B'),
104 [ qw(Test::B Test::D Test::E Test::O) ]
105 ), '... got the right MRO for Test::B');
108 mro::get_linear_isa('Test::A'),
109 [ qw(Test::A Test::B Test::C Test::D Test::E Test::F Test::O) ]
110 ), '... got the right MRO for Test::A');
112 is(Test::A->C_or_D, 'Test::C', '... got the expected method output');
113 is(Test::A->can('C_or_D')->(), 'Test::C', '... can got the expected method output');
114 is(Test::A->C_or_E, 'Test::C', '... got the expected method output');
115 is(Test::A->can('C_or_E')->(), 'Test::C', '... can got the expected method output');