From: gfx Date: Tue, 22 Sep 2009 02:40:17 +0000 (+0900) Subject: Fix tests X-Git-Tag: 0.32~13 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=92989046ccc2d4519620a1c03b721d611fd123d2;p=gitmo%2FMouse.git Fix tests --- diff --git a/t/403-method-modifiers.t b/t/403-method-modifiers.t index 6c316b3..8a4317f 100644 --- a/t/403-method-modifiers.t +++ b/t/403-method-modifiers.t @@ -3,7 +3,7 @@ use strict; use warnings; use Test::More; BEGIN { - if (eval "require Class::Method::Modifiers; 1") { + if (eval {require Class::Method::Modifiers::Fast } || eval {require Class::Method::Modifiers }) { plan tests => 4; } else { diff --git a/t/800_shikabased/012-role-compatibility.t b/t/800_shikabased/012-role-compatibility.t index 15584aa..44a46b0 100644 --- a/t/800_shikabased/012-role-compatibility.t +++ b/t/800_shikabased/012-role-compatibility.t @@ -1,38 +1,35 @@ use strict; use warnings; -use Test::More; -plan skip_all => "This test requires Moose" unless eval "require Moose; 1;"; -plan tests => 4; +use Test::More tests => 5; -test('Moose'); -test('Mouse'); -exit; - -sub test { - my $class = shift; - eval <<"..."; { - package ${class}Parent; - use ${class}; - sub parent_method { 'ok' } + package ParentRole; + use Mouse::Role; + sub parent_method { 'parent_method' } } { - package ${class}ChildRole; - use ${class}::Role; - use base qw/${class}Parent/; - sub conflict { "role's" } + package ChildRole; + use Mouse::Role; + + with 'ParentRole'; + + sub child_method { "role's" } } { - package ${class}Class; - use ${class}; - with '${class}ChildRole'; - sub conflict { "class's" } -} -... - die $@ if $@; - ok !"${class}Class"->can('parent_method'); - is "${class}Class"->conflict(), "class's"; + package Class; + use Mouse; + with 'ChildRole'; + + sub child_method { "class's" } } +my $o = Class->new; + +ok $o->does('ChildRole'), 'does ChildRole'; +ok $o->does('ParentRole'), 'does ParentRole'; +can_ok $o, qw(parent_method child_method); +is $o->parent_method, 'parent_method'; +is $o->child_method, "class's"; +