sub req1 { }
}
+BEGIN {
+ package ExtraRole;
+ use Role::Tiny;
+
+ sub extra1 { 'role extra' }
+}
+
sub try_apply_to {
my $to = shift;
exception { Role::Tiny->apply_role_to_package($to, 'MyRole') }
is(MyClass->bar, 'role bar', 'method from role');
is(MyClass->baz, 'class baz', 'method from class');
ok(MyClass->does('MyRole'), 'class does role');
+ok(!MyClass->does('IntermediaryRole'), 'class does not do non-applied role');
ok(!MyClass->does('Random'), 'class does not do non-role');
like(try_apply_to('NoMethods'), qr/req1, req2/, 'error for both methods');
is(ExtraClass->bar, 'role bar', 'method from role');
is(ExtraClass->baz, 'class baz', 'method from class');
+my $new_class;
+is exception {
+ $new_class = Role::Tiny->create_class_with_roles('MyClass', 'ExtraRole');
+}, undef, 'No errors creating class with roles';
+
+isa_ok($new_class, 'MyClass');
+is($new_class->extra1, 'role extra', 'method from role');
+
done_testing;