X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMouse.git;a=blobdiff_plain;f=t%2F020_attributes%2F005_attribute_does.t;fp=t%2F020_attributes%2F005_attribute_does.t;h=0000000000000000000000000000000000000000;hp=267f98d289f62e14698f8e7f1e2f4f88264e20fc;hb=fde8e43f95fe996fbc2a778aa259feeb04552171;hpb=0bdc9d38dfd3de07aad929f6629f8fa65d434c27 diff --git a/t/020_attributes/005_attribute_does.t b/t/020_attributes/005_attribute_does.t deleted file mode 100644 index 267f98d..0000000 --- a/t/020_attributes/005_attribute_does.t +++ /dev/null @@ -1,106 +0,0 @@ -#!/usr/bin/perl - -use strict; -use warnings; - -use Test::More tests => 9; -use Test::Exception; - - - -{ - package Foo::Role; - use Mouse::Role; - use Mouse::Util::TypeConstraints; - - # if does() exists on its own, then - # we create a type constraint for - # it, just as we do for isa() - has 'bar' => (is => 'rw', does => 'Bar::Role'); - has 'baz' => ( - is => 'rw', - does => 'Bar::Role' - ); - - package Bar::Role; - use Mouse::Role; - - # if isa and does appear together, then see if Class->does(Role) - # if it does work... then the does() check is actually not needed - # since the isa() check will imply the does() check - has 'foo' => (is => 'rw', isa => 'Foo::Class'); - - package Foo::Class; - use Mouse; - - with 'Foo::Role'; - - package Bar::Class; - use Mouse; - - with 'Bar::Role'; - -} - -my $foo = Foo::Class->new; -isa_ok($foo, 'Foo::Class'); - -my $bar = Bar::Class->new; -isa_ok($bar, 'Bar::Class'); - -lives_ok { - $foo->bar($bar); -} '... bar passed the type constraint okay'; - -dies_ok { - $foo->bar($foo); -} '... foo did not pass the type constraint okay'; - -lives_ok { - $foo->baz($bar); -} '... baz passed the type constraint okay'; - -dies_ok { - $foo->baz($foo); -} '... foo did not pass the type constraint okay'; - -lives_ok { - $bar->foo($foo); -} '... foo passed the type constraint okay'; - - - -# some error conditions - -{ - package Baz::Class; - use Test::More; - use Mouse; - - # if isa and does appear together, then see if Class->does(Role) - # if it does not,.. we have a conflict... so we die loudly - ::dies_ok { - has 'foo' => (is => 'rw', isa => 'Foo::Class', does => 'Bar::Class'); - } '... cannot have a does() which is not done by the isa()'; -} - -{ - package Bling; - use strict; - use warnings; - - sub bling { 'Bling::bling' } - - package Bling::Bling; - use Test::More; - use Mouse; - - # if isa and does appear together, then see if Class->does(Role) - # if it does not,.. we have a conflict... so we die loudly - ::dies_ok { - has 'foo' => (is => 'rw', isa => 'Bling', does => 'Bar::Class'); - } '... cannot have a isa() which is cannot does()'; -} - - -