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 Class::C3::initialize();
54 is(Diamond_D->hello, 'Diamond_C::hello', '... method resolves with the correct MRO');
55 is(Diamond_D->goodbye, 'Diamond_C::goodbye', '... method resolves with the correct MRO');
58 no warnings 'redefine';
60 *{"Diamond_D::goodbye"} = sub { 'Diamond_D::goodbye' };
63 is(Diamond_D->goodbye, 'Diamond_D::goodbye', '... method overwritten');
65 is($Diamond_D::hello, 'hello', '... our SCALAR package vars are here');
69 '... our ARRAY package vars are here');
72 { h => 1, e => 2, l => "3 & 4", o => 5 },
73 '... our HASH package vars are here');
75 Class::C3::uninitialize();
77 is(Diamond_D->hello, 'Diamond_A::hello', '... method resolves with reinitialized MRO');
78 is(Diamond_D->goodbye, 'Diamond_D::goodbye', '... uninitialize does not mess with the manually changed method');
80 is($Diamond_D::hello, 'hello', '... our SCALAR package vars are still here');
84 '... our ARRAY package vars are still here');
87 { h => 1, e => 2, l => "3 & 4", o => 5 },
88 '... our HASH package vars are still here');