From: Stevan Little Date: Mon, 23 Oct 2006 13:23:52 +0000 (+0000) Subject: this is broken, we need to fix it X-Git-Tag: 0_15~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=825a80dec36c7a359993cc8dc60af9463fdeb0c7;p=gitmo%2FMoose.git this is broken, we need to fix it --- diff --git a/lib/Moose/Meta/Role.pm b/lib/Moose/Meta/Role.pm index 5066f06..6eec907 100644 --- a/lib/Moose/Meta/Role.pm +++ b/lib/Moose/Meta/Role.pm @@ -11,7 +11,7 @@ use B 'svref_2object'; use Moose::Meta::Class; -our $VERSION = '0.04'; +our $VERSION = '0.05'; use base 'Class::MOP::Module'; diff --git a/t/046_roles_and_required_method_edge_cases.t b/t/046_roles_and_required_method_edge_cases.t index 5b4b478..7191d54 100644 --- a/t/046_roles_and_required_method_edge_cases.t +++ b/t/046_roles_and_required_method_edge_cases.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => 17; +use Test::More tests => 18; use Test::Exception; BEGIN { @@ -188,5 +188,44 @@ method modifier. with 'Role::RequireFoo'; } '... the required "foo" method exists, but it is a before (and we will die)'; } + +# ... +# a method required in a role, but then +# implemented in the superclass (as an +# attribute accessor too) + +{ + package Foo::Class::Base; + use Moose; + + has 'bar' => ( + isa => 'Int', + is => 'rw', + default => sub { 1 } + ); +} +{ + package Foo::Role; + use Moose::Role; + + requires 'bar'; - \ No newline at end of file + has 'foo' => ( + isa => 'Int', + is => 'rw', + lazy => 1, + default => sub { (shift)->bar + 1 } + ); +} +{ + package Foo::Class::Child; + use Moose; + extends 'Foo::Class::Base'; + + ::dies_ok { + with 'Foo::Role'; + } '... our role combined successfully'; +} + + +