6 use Test::More tests => 4;
23 sub hello { 'Diamond_A::hello' }
34 sub hello { 'Diamond_C::hello' }
38 use base ('Diamond_B', 'Diamond_C');
42 Class::C3::initialize();
45 [ Class::C3::calculateMRO('Diamond_D') ],
46 [ qw(Diamond_D Diamond_B Diamond_C Diamond_A) ],
47 '... got the right MRO for Diamond_D');
51 Then change it to this:
64 sub hello { 'Diamond_E::hello' }
69 unshift @{"Diamond_B::ISA"} => 'Diamond_E';
73 [ Class::C3::calculateMRO('Diamond_D') ],
74 [ qw(Diamond_D Diamond_B Diamond_E Diamond_C Diamond_A) ],
75 '... got the new MRO for Diamond_D');
77 # Doesn't work with core support, since reinit is not neccesary and the change
78 # takes effect immediately
80 skip "This test does not work with a c3-patched perl interpreter", 1
81 if $Class::C3::C3_IN_CORE;
82 is(Diamond_D->hello, 'Diamond_C::hello', '... method still resolves with old MRO');
85 Class::C3::reinitialize();
87 is(Diamond_D->hello, 'Diamond_E::hello', '... method resolves with reinitialized MRO');