Move a test as t/052-unidefined-type-in-union.t
gfx [Wed, 30 Sep 2009 04:58:57 +0000 (13:58 +0900)]
t/052-undefined-type-in-union.t [new file with mode: 0755]
t/990_deprecated/990-undefined-class-type.t [deleted file]

diff --git a/t/052-undefined-type-in-union.t b/t/052-undefined-type-in-union.t
new file mode 100755 (executable)
index 0000000..b2c1235
--- /dev/null
@@ -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 (executable)
index 4a5e314..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-#!perl\r
-\r
-use strict;
-use warnings;
-use Test::More tests => 5;\r
-\r
-use Mouse::Util::TypeConstraints;\r
-
-my $z = Mouse::Util::TypeConstraints::find_or_create_isa_type_constraint('My::New::Class | Str');
-\r
-#diag $z->dump;\r
-
-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');
-