From: Toby Inkster Date: Tue, 30 Oct 2012 22:02:29 +0000 (+0000) Subject: get ilmari's test to pass X-Git-Tag: v1.000007~3 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7b27f050d312c5659639ea4f71fd3a39363d9b6f;p=gitmo%2FMoo.git get ilmari's test to pass --- diff --git a/lib/Moo/HandleMoose.pm b/lib/Moo/HandleMoose.pm index e03e49c..21af12c 100644 --- a/lib/Moo/HandleMoose.pm +++ b/lib/Moo/HandleMoose.pm @@ -66,9 +66,13 @@ sub inject_real_metaclass_for { ); } }; - + my %methods = %{Role::Tiny->_concrete_methods_of($name)}; + while (my ($meth_name, $meth_code) = each %methods) { + $meta->add_method($meth_name, $meth_code) if $meth_code; + } + # if stuff gets added afterwards, _maybe_reset_handlemoose should # trigger the recreation of the metaclass but we need to ensure the # Role::Tiny cache is cleared so we don't confuse Moo itself. diff --git a/xt/moose-does-moo-role.t b/xt/moose-does-moo-role.t index e9c89db..163908c 100644 --- a/xt/moose-does-moo-role.t +++ b/xt/moose-does-moo-role.t @@ -43,15 +43,12 @@ use Moo::HandleMoose; for my $parent (qw(MooseParent MooParent)) { for my $child (qw(MooRoledMooClass MooRoledMooseClass)) { - lives_and { - my $o = $parent->new( - e => $child->new(), - ); - ok( $o->e->does("MooParentRole"), "$child does parent MooRole" ); - can_ok( $o->e, "role_method" ); - local $TODO = "multi-level roles are broken with moose" if $child eq "MooRoledMooseClass"; - can_ok( $o->e, "parent_role_method" ); - } "$parent instantiated with a $child delegate that does a MooRole"; + my $o = $parent->new( + e => $child->new(), + ); + ok( $o->e->does("MooParentRole"), "$child does parent MooRole" ); + can_ok( $o->e, "role_method" ); + can_ok( $o->e, "parent_role_method" ); } }