6 use open qw( :utf8 :std );
8 require q(./test.pl); plan(tests => 10);
12 This example is take from: http://www.python.org/2.3/mro.html
26 Level 3 | O | (more general)
32 Level 2 3 | D | 4| E | | F | 5 |
38 Level 1 1 | B | | C | 2 |
43 Level 0 0 | A | (more specialized)
60 sub ƈ_or_ऍ { '텟ţ::ऍ' }
66 sub ƈ_or_Ḋ { '텟ţ::Ḋ' }
69 use base ('텟ţ::Ḋ', '텟ţ::Ḟ');
72 sub ƈ_or_Ḋ { '텟ţ::ƈ' }
73 sub ƈ_or_ऍ { '텟ţ::ƈ' }
77 use base ('텟ţ::Ḋ', '텟ţ::ऍ');
80 use base ('텟ţ::ᛒ', '텟ţ::ƈ');
85 mro::get_linear_isa('텟ţ::Ḟ'),
87 ), '... got the right MRO for 텟ţ::Ḟ');
90 mro::get_linear_isa('텟ţ::ऍ'),
92 ), '... got the right MRO for 텟ţ::ऍ');
95 mro::get_linear_isa('텟ţ::Ḋ'),
97 ), '... got the right MRO for 텟ţ::Ḋ');
100 mro::get_linear_isa('텟ţ::ƈ'),
101 [ qw(텟ţ::ƈ 텟ţ::Ḋ 텟ţ::ᴼ 텟ţ::Ḟ) ]
102 ), '... got the right MRO for 텟ţ::ƈ');
105 mro::get_linear_isa('텟ţ::ᛒ'),
106 [ qw(텟ţ::ᛒ 텟ţ::Ḋ 텟ţ::ᴼ 텟ţ::ऍ) ]
107 ), '... got the right MRO for 텟ţ::ᛒ');
110 mro::get_linear_isa('텟ţ::ଅ'),
111 [ qw(텟ţ::ଅ 텟ţ::ᛒ 텟ţ::Ḋ 텟ţ::ᴼ 텟ţ::ऍ 텟ţ::ƈ 텟ţ::Ḟ) ]
112 ), '... got the right MRO for 텟ţ::ଅ');
114 is(텟ţ::ଅ->ƈ_or_Ḋ, '텟ţ::Ḋ', '... got the expected method output');
115 is(텟ţ::ଅ->can('ƈ_or_Ḋ')->(), '텟ţ::Ḋ', '... can got the expected method output');
116 is(텟ţ::ଅ->ƈ_or_ऍ, '텟ţ::ऍ', '... got the expected method output');
117 is(텟ţ::ଅ->can('ƈ_or_ऍ')->(), '텟ţ::ऍ', '... can got the expected method output');