6 use Test::More tests => 8;
19 # if does() exists on its own, then
20 # we create a type constraint for
21 # it, just as we do for isa()
22 has 'bar' => (is => 'rw', does => 'Bar::Role');
29 # if isa and does appear together, then see if Class->does(Role)
30 # if it does work... then the does() check is actually not needed
31 # since the isa() check will imply the does() check
32 has 'foo' => (is => 'rw', isa => 'Foo::Class', does => 'Foo::Role');
50 my $foo = Foo::Class->new;
51 isa_ok($foo, 'Foo::Class');
53 my $bar = Bar::Class->new;
54 isa_ok($bar, 'Bar::Class');
58 } '... bar passed the type constraint okay';
62 } '... foo did not pass the type constraint okay';
66 } '... foo passed the type constraint okay';
68 # some error conditions
76 # if isa and does appear together, then see if Class->does(Role)
77 # if it does not,.. we have a conflict... so we die loudly
79 has 'foo' => (isa => 'Foo::Class', does => 'Bar::Class');
80 } '... cannot have a does() which is not done by the isa()';
88 sub bling { 'Bling::bling' }
95 # if isa and does appear together, then see if Class->does(Role)
96 # if it does not,.. we have a conflict... so we die loudly
98 has 'foo' => (isa => 'Bling', does => 'Bar::Class');
99 } '... cannot have a isa() which is cannot does()';