X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F02_MRO.t;h=72001d02a645ae475a24628688931300c99f6c85;hb=HEAD;hp=d4bf02cad6482ff0392dc2dd8e2c974a1ed164f1;hpb=8995e8271e0f7f7b9c0942a4425e8a44099bf608;p=gitmo%2FClass-C3-XS.git diff --git a/t/02_MRO.t b/t/02_MRO.t index d4bf02c..72001d0 100644 --- a/t/02_MRO.t +++ b/t/02_MRO.t @@ -3,13 +3,10 @@ use strict; use warnings; -use Test::More tests => 15; +use Test::More tests => 7; BEGIN { - use_ok('Class::C3'); - # uncomment this line, and re-run the - # test to see the normal p5 dispatch order - #$Class::C3::TURN_OFF_C3 = 1; + use_ok('Class::C3::XS'); } =pod @@ -52,85 +49,54 @@ Level 0 0 | A | (more specialized) { package Test::O; - use Class::C3; + our @ISA = qw//; package Test::F; - use Class::C3; use base 'Test::O'; package Test::E; use base 'Test::O'; - use Class::C3; - sub C_or_E { 'Test::E' } - package Test::D; - use Class::C3; use base 'Test::O'; - sub C_or_D { 'Test::D' } - package Test::C; use base ('Test::D', 'Test::F'); - use Class::C3; - sub C_or_D { 'Test::C' } - sub C_or_E { 'Test::C' } - package Test::B; - use Class::C3; use base ('Test::D', 'Test::E'); package Test::A; use base ('Test::B', 'Test::C'); - use Class::C3; } -Class::C3::initialize(); - is_deeply( - [ Class::C3::calculateMRO('Test::F') ], + [ Class::C3::XS::calculateMRO('Test::F') ], [ qw(Test::F Test::O) ], '... got the right MRO for Test::F'); is_deeply( - [ Class::C3::calculateMRO('Test::E') ], + [ Class::C3::XS::calculateMRO('Test::E') ], [ qw(Test::E Test::O) ], '... got the right MRO for Test::E'); is_deeply( - [ Class::C3::calculateMRO('Test::D') ], + [ Class::C3::XS::calculateMRO('Test::D') ], [ qw(Test::D Test::O) ], '... got the right MRO for Test::D'); is_deeply( - [ Class::C3::calculateMRO('Test::C') ], + [ Class::C3::XS::calculateMRO('Test::C') ], [ qw(Test::C Test::D Test::F Test::O) ], '... got the right MRO for Test::C'); is_deeply( - [ Class::C3::calculateMRO('Test::B') ], + [ Class::C3::XS::calculateMRO('Test::B') ], [ qw(Test::B Test::D Test::E Test::O) ], '... got the right MRO for Test::B'); is_deeply( - [ Class::C3::calculateMRO('Test::A') ], + [ Class::C3::XS::calculateMRO('Test::A') ], [ qw(Test::A Test::B Test::C Test::D Test::E Test::F Test::O) ], '... got the right MRO for Test::A'); -is(Test::A->C_or_D, 'Test::C', '... got the expected method output'); -is(Test::A->can('C_or_D')->(), 'Test::C', '... can got the expected method output'); - -is(Test::A->C_or_E, 'Test::C', '... got the expected method output'); -is(Test::A->can('C_or_E')->(), 'Test::C', '... can got the expected method output'); - -# remove the C3 -Class::C3::uninitialize(); - -is(Test::A->C_or_D, 'Test::D', '... old method resolution has been restored'); -is(Test::A->can('C_or_D')->(), 'Test::D', '... old can(method) resolution has been restored'); - -is(Test::A->C_or_E, 'Test::E', '... old method resolution has been restored'); -is(Test::A->can('C_or_E')->(), 'Test::E', '... old can(method) resolution has been restored'); - - \ No newline at end of file