1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
|
## no critic (Modules::ProhibitMultiplePackages, Moose::RequireCleanNamespace, Moose::RequireMakeImmutable)
use strict;
use warnings;
use Test::Needs {
Moose => '2.1207',
};
use Test::Fatal;
use Test::More 0.96;
{
package RoleA;
use Specio::Library::Builtins;
use Moose::Role;
has 'A' => (
is => 'rw',
isa => t('HashRef'),
);
package RoleB;
use Moose::Role;
with 'RoleA';
package ClassA;
use Moose;
# The fact that RoleB _already_ has RoleA triggers Moose's internal Role
# summation algorithm. That in turn attempts to compare each attribute of
# the roles for equality. This requires that the types passed for "isa" in
# the attribute definition implement equality comparison overloading if
# they are objects.
::is(
::exception { with 'RoleA', 'RoleB' },
undef,
'no exception consuming RoleA and RoleB',
);
}
done_testing();
|