X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F107_C3MethodDispatchOrder_test.t;h=32db56bf8a1a01a12803d88749aa358ee28f4def;hb=0cf811c0867feb0e846eb3bc1f34aee4a1f169f1;hp=c00f0375892880cd205e2485f215182a91ed696e;hpb=10dd437b9a873b2fcbe64d908fcad09546480fd4;p=gitmo%2FClass-MOP.git diff --git a/t/107_C3MethodDispatchOrder_test.t b/t/107_C3MethodDispatchOrder_test.t index c00f037..32db56b 100644 --- a/t/107_C3MethodDispatchOrder_test.t +++ b/t/107_C3MethodDispatchOrder_test.t @@ -1,38 +1,36 @@ -#!/usr/bin/perl - use strict; use warnings; use Test::More; use File::Spec; +use Class::MOP; -BEGIN { - eval "use Algorithm::C3"; - plan skip_all => "Algorithm::C3 required for this test" if $@; - plan tests => 5; +use Test::Requires { + 'Algorithm::C3' => '0.01', # skip all if not installed +}; - use_ok('Class::MOP'); +BEGIN { require_ok(File::Spec->catfile('examples', 'C3MethodDispatchOrder.pod')); } { package Diamond_A; - use metaclass 'C3MethodDispatchOrder'; - + use metaclass 'C3MethodDispatchOrder'; + sub hello { 'Diamond_A::hello' } package Diamond_B; - use metaclass 'C3MethodDispatchOrder'; - __PACKAGE__->meta->superclasses('Diamond_A'); - + use metaclass 'C3MethodDispatchOrder'; + __PACKAGE__->meta->superclasses('Diamond_A'); + package Diamond_C; - use metaclass 'C3MethodDispatchOrder'; - __PACKAGE__->meta->superclasses('Diamond_A'); - + use metaclass 'C3MethodDispatchOrder'; + __PACKAGE__->meta->superclasses('Diamond_A'); + sub hello { 'Diamond_C::hello' } package Diamond_D; - use metaclass 'C3MethodDispatchOrder'; + use metaclass 'C3MethodDispatchOrder'; __PACKAGE__->meta->superclasses('Diamond_B', 'Diamond_C'); } @@ -44,4 +42,4 @@ is_deeply( is(Diamond_D->hello, 'Diamond_C::hello', '... got the right dispatch order'); is(Diamond_D->can('hello')->(), 'Diamond_C::hello', '... can(method) resolved itself as expected'); - +done_testing;