X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fcompose-roles.t;fp=t%2Fcompose-roles.t;h=26c35a1649e638052858a6395da970e262ce1101;hb=4055038d2a1b634c49ffbda0c25b460dd2c6c561;hp=162f7106de0738d64b977c7f9c6f7ff8571e38bd;hpb=92f0702e452af6b823a40c4ff19f747698112c5d;p=gitmo%2FMoo.git diff --git a/t/compose-roles.t b/t/compose-roles.t index 162f710..26c35a1 100644 --- a/t/compose-roles.t +++ b/t/compose-roles.t @@ -83,7 +83,7 @@ is($o2->attr2, -2, 'constructor includes role'); } is exception { - package EmptyClass; + package ClassWithExtension; use Moo; Moo::Role->apply_roles_to_object( Moo->_accessor_maker_for(__PACKAGE__), @@ -92,4 +92,27 @@ is exception { with qw(RoleWithAttr RoleWithReq); }, undef, 'apply_roles_to_object correctly calls accessor generator'; +{ + package EmptyClass; + use Moo; +} + +{ + package RoleWithReq2; + use Moo::Role; + requires 'attr2'; +} + +is exception { + Moo::Role->create_class_with_roles( + 'EmptyClass', 'RoleWithReq2', 'RoleWithAttr2'); +}, undef, 'create_class_with_roles accepts attributes for requirements'; + +like exception { + Moo::Role->create_class_with_roles( + 'EmptyClass', 'RoleWithReq2', 'RoleWithAttr'); +}, qr/Can't apply .* missing attr2/, + 'create_class_with_roles accepts attributes for requirements'; + + done_testing;