From: gfx Date: Wed, 30 Sep 2009 04:58:57 +0000 (+0900) Subject: Move a test as t/052-unidefined-type-in-union.t X-Git-Tag: 0.37_01~27 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=305b0c491a2df8d839846d827d3e131910476633;p=gitmo%2FMouse.git Move a test as t/052-unidefined-type-in-union.t --- diff --git a/t/052-undefined-type-in-union.t b/t/052-undefined-type-in-union.t new file mode 100755 index 0000000..b2c1235 --- /dev/null +++ b/t/052-undefined-type-in-union.t @@ -0,0 +1,34 @@ +#!perl + +use strict; +use warnings; +use Test::More tests => 6; + +use Mouse::Util::TypeConstraints; + +{ + package Foo; + use Mouse; + + has my_class => ( + is => 'rw', + isa => 'My::New::Class | Str', + ); +} +my $t = Foo->meta->get_attribute('my_class')->type_constraint; + +eval q{ + package My::New::Class; + use Mouse; + package My::New::DerivedClass; + use Mouse; + extends 'My::New::Class'; +}; + +isa_ok $t, 'Mouse::Meta::TypeConstraint'; +ok $t->check(My::New::Class->new); +ok $t->check(My::New::DerivedClass->new); +ok $t->check('Foo'); +ok!$t->check(undef); +ok!$t->check(bless {}, 'Foo'); + diff --git a/t/990_deprecated/990-undefined-class-type.t b/t/990_deprecated/990-undefined-class-type.t deleted file mode 100755 index 4a5e314..0000000 --- a/t/990_deprecated/990-undefined-class-type.t +++ /dev/null @@ -1,26 +0,0 @@ -#!perl - -use strict; -use warnings; -use Test::More tests => 5; - -use Mouse::Util::TypeConstraints; - -my $z = Mouse::Util::TypeConstraints::find_or_create_isa_type_constraint('My::New::Class | Str'); - -#diag $z->dump; - -eval q{ - package My::New::Class; - use Mouse; - package My::New::DerivedClass; - use Mouse; - extends 'My::New::Class'; -}; - -ok $z->check(My::New::Class->new); -ok $z->check(My::New::DerivedClass->new); -ok $z->check('Foo'); -ok!$z->check(undef); -ok!$z->check(bless {}, 'Foo'); -