2 # This is automatically generated by author/import-moose-test.pl.
3 # DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!!
4 use t::lib::MooseCompat;
16 use Mouse::Util::TypeConstraints;
18 # if does() exists on its own, then
19 # we create a type constraint for
20 # it, just as we do for isa()
21 has 'bar' => (is => 'rw', does => 'Bar::Role');
24 does => role_type('Bar::Role')
35 # if isa and does appear together, then see if Class->does(Role)
36 # if it does work... then the does() check is actually not needed
37 # since the isa() check will imply the does() check
38 has 'foo' => (is => 'rw', isa => 'Foo::Class', does => 'Foo::Role');
46 my $foo = Foo::Class->new;
47 isa_ok($foo, 'Foo::Class');
49 my $bar = Bar::Class->new;
50 isa_ok($bar, 'Bar::Class');
54 } '... bar passed the type constraint okay';
58 } '... foo did not pass the type constraint okay';
62 } '... baz passed the type constraint okay';
66 } '... foo did not pass the type constraint okay';
70 } '... foo passed the type constraint okay';
74 # some error conditions
80 # if isa and does appear together, then see if Class->does(Role)
81 # if it does not,.. we have a conflict... so we die loudly
83 has 'foo' => (isa => 'Foo::Class', does => 'Bar::Class');
84 } '... cannot have a does() which is not done by the isa()';
92 sub bling { 'Bling::bling' }
97 # if isa and does appear together, then see if Class->does(Role)
98 # if it does not,.. we have a conflict... so we die loudly
100 has 'foo' => (isa => 'Bling', does => 'Bar::Class');
101 } '... cannot have a isa() which is cannot does()';