is $backcompat_called, 0,
'overridden role_application_steps prevents backcompat attempt';
+{
+ package RoleExtension3;
+ use base 'Role::Tiny';
+
+ sub _composable_package_for {
+ my ($self, $role) = @_;
+ my $composed_name = 'Role::Tiny::_COMPOSABLE::'.$role;
+ return $composed_name if $Role::Tiny::COMPOSED{role}{$composed_name};
+ no strict 'refs';
+ *{"${composed_name}::extra_sub"} = sub {};
+ $self->SUPER::_composable_package_for($role);
+ }
+}
+
+{
+ package Class2;
+ sub foo {}
+}
+{
+ package Role3;
+ $INC{'Role3.pm'} = __FILE__;
+ use Role::Tiny;
+ requires 'extra_sub';
+}
+ok eval { RoleExtension3->create_class_with_roles('Class2', 'Role3') },
+ 'requires is satisfied by subs generated by _composable_package_for';
+
+{
+ package Role4;
+ $INC{'Role4.pm'} = __FILE__;
+ use Role::Tiny;
+ requires 'extra_sub2';
+}
+ok !eval { RoleExtension3->create_class_with_roles('Class2', 'Role4'); },
+ 'requires checked properly during create_class_with_roles';
+
+{
+ package Role5;
+ $INC{'Role5.pm'} = __FILE__;
+ use Role::Tiny;
+ around extra_sub2 => sub { my $orig = shift; $orig->(@_); };
+}
+ok !eval { RoleExtension3->create_class_with_roles('Class3', 'Role4'); },
+ 'requires checked properly during create_class_with_roles';
+
done_testing;