6 use Test::More tests => 12;
10 # uncomment this line, and re-run the
11 # test to see the normal p5 dispatch order
12 #$Class::C3::TURN_OFF_C3 = 1;
28 sub hello { 'Diamond_A::hello' }
39 sub goodbye { 'Diamond_C::goodbye' }
40 sub hello { 'Diamond_C::hello' }
44 use base ('Diamond_B', 'Diamond_C');
47 our @hello = qw(h e l l o);
49 our %hello = (h => 1, e => 2, l => "3 & 4", o => 5)
52 is(Diamond_D->hello, 'Diamond_C::hello', '... method resolves with the correct MRO');
53 is(Diamond_D->goodbye, 'Diamond_C::goodbye', '... method resolves with the correct MRO');
56 no warnings 'redefine';
58 *{"Diamond_D::goodbye"} = sub { 'Diamond_D::goodbye' };
61 is(Diamond_D->goodbye, 'Diamond_D::goodbye', '... method overwritten');
63 is($Diamond_D::hello, 'hello', '... our SCALAR package vars are here');
67 '... our ARRAY package vars are here');
70 { h => 1, e => 2, l => "3 & 4", o => 5 },
71 '... our HASH package vars are here');
73 Class::C3::uninitialize();
75 is(Diamond_D->hello, 'Diamond_A::hello', '... method resolves with reinitialized MRO');
76 is(Diamond_D->goodbye, 'Diamond_D::goodbye', '... uninitialize does not mess with the manually changed method');
78 is($Diamond_D::hello, 'hello', '... our SCALAR package vars are still here');
82 '... our ARRAY package vars are still here');
85 { h => 1, e => 2, l => "3 & 4", o => 5 },
86 '... our HASH package vars are still here');