From: Jesse Luehrs Date: Tue, 8 Mar 2011 07:58:11 +0000 (-0600) Subject: todo test for the role composition issue X-Git-Tag: 1.9905~19 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=0cef9fe9578af77e5d75d73344195c16101c386b;p=gitmo%2FMoose.git todo test for the role composition issue --- diff --git a/t/030_roles/046_role_attr_application.t b/t/030_roles/046_role_attr_application.t index 17b608a..bd0e728 100644 --- a/t/030_roles/046_role_attr_application.t +++ b/t/030_roles/046_role_attr_application.t @@ -2,6 +2,7 @@ use strict; use warnings; use Test::More; +use Test::Moose; { package Foo::Meta::Attribute; @@ -201,4 +202,48 @@ ok(!Moose::Util::does_role(Baz->meta->get_attribute('foo'), 'Baz::Meta::Attribut can_ok('Class::With::Role::With::Trait', 'bar'); } +{ + package Quux::Meta::Role::Attribute; + use Moose::Role; +} + +{ + package Quux::Role1; + use Moose::Role; + + has foo => (traits => ['Quux::Meta::Role::Attribute'], is => 'ro'); +} + +{ + package Quux::Role2; + use Moose::Role; + Moose::Util::MetaRole::apply_metaroles( + for => __PACKAGE__, + role_metaroles => { + applied_attribute => ['Quux::Meta::Role::Attribute'] + }, + ); + + has bar => (is => 'ro'); +} + +{ + package Quux; + use Moose; + with 'Quux::Role1', 'Quux::Role2'; +} + +{ + my $foo = Quux->meta->get_attribute('foo'); + does_ok($foo, 'Quux::Meta::Role::Attribute', + "individual attribute trait applied correctly"); +} + +{ + local $TODO = "applied_attribute metaroles are lost in role composition"; + my $bar = Quux->meta->get_attribute('bar'); + does_ok($bar, 'Quux::Meta::Role::Attribute', + "attribute metarole applied correctly"); +} + done_testing;