}
is exception {
- package EmptyClass;
+ package ClassWithExtension;
use Moo;
Moo::Role->apply_roles_to_object(
Moo->_accessor_maker_for(__PACKAGE__),
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;
with qw(Splat NeedTrap);
}, undef, 'requires satisfied by Moose attribute composed at the same time';
+{
+ package HasMonkey;
+ use Moo;
+ sub monkey {}
+}
+is exception {
+ Moo::Role->create_class_with_roles('HasMonkey', 'Splat', 'NeedTrap');
+}, undef, ' ... and when created by create_class_with_roles';
done_testing;