From: Tokuhiro Matsuno Date: Sun, 7 Dec 2008 11:58:22 +0000 (+0000) Subject: added test case for compatibility X-Git-Tag: 0.19~136^2~6 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1e7a7baa941314cdbf9ba898e7885367a39b6a76;p=gitmo%2FMouse.git added test case for compatibility --- diff --git a/t/800_shikabased/012-role-compatibility.t b/t/800_shikabased/012-role-compatibility.t new file mode 100644 index 0000000..15584aa --- /dev/null +++ b/t/800_shikabased/012-role-compatibility.t @@ -0,0 +1,38 @@ +use strict; +use warnings; +use Test::More; +plan skip_all => "This test requires Moose" unless eval "require Moose; 1;"; +plan tests => 4; + +test('Moose'); +test('Mouse'); +exit; + +sub test { + my $class = shift; + eval <<"..."; +{ + package ${class}Parent; + use ${class}; + sub parent_method { 'ok' } +} + +{ + package ${class}ChildRole; + use ${class}::Role; + use base qw/${class}Parent/; + sub conflict { "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"; +} +