6 use Test::More tests => 5;
10 # uncomment this line, and re-run the
11 # test to see the normal p5 dispatch order
12 #$Class::C3::TURN_OFF_C3 = 1;
30 sub hello { 'Diamond_A::hello' }
41 sub hello { 'Diamond_C::hello' }
45 use base ('Diamond_B', 'Diamond_C');
50 [ Class::C3::calculateMRO('Diamond_D') ],
51 [ qw(Diamond_D Diamond_B Diamond_C Diamond_A) ],
52 '... got the right MRO for Diamond_D');
56 Then change it to this:
69 sub hello { 'Diamond_E::hello' }
74 unshift @{"Diamond_B::ISA"} => 'Diamond_E';
78 [ Class::C3::calculateMRO('Diamond_D') ],
79 [ qw(Diamond_D Diamond_B Diamond_E Diamond_C Diamond_A) ],
80 '... got the new MRO for Diamond_D');
82 is(Diamond_D->hello, 'Diamond_C::hello', '... method still resolves with old MRO');
84 Class::C3::reinitialize();
86 is(Diamond_D->hello, 'Diamond_E::hello', '... method resolves with reinitialized MRO');