Regenerate test files
[gitmo/Mouse.git] / t / 040_type_constraints / 010_misc_type_tests.t
index 43fcebc..57bc59f 100644 (file)
@@ -1,10 +1,15 @@
 #!/usr/bin/perl
+# This is automatically generated by author/import-moose-test.pl.
+# DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!!
+use t::lib::MooseCompat;
 
 use strict;
 use warnings;
 
-use Test::More tests => 11;
+use Test::More;
+$TODO = q{Mouse is not yet completed};
 use Test::Exception;
+use Scalar::Util qw(refaddr);
 
 BEGIN {
     use_ok('Mouse::Util::TypeConstraints');
@@ -22,7 +27,7 @@ isa_ok($numb3rs, 'Mouse::Meta::TypeConstraint');
 # subtype with unions
 
 {
-    package Test::Mouse::Meta::TypeConstraint::Union;
+    package Test::Mouse::Meta::TypeConstraint;
 
     use overload '""' => sub {'Broken|Test'}, fallback => 1;
     use Mouse;
@@ -30,12 +35,12 @@ isa_ok($numb3rs, 'Mouse::Meta::TypeConstraint');
     extends 'Mouse::Meta::TypeConstraint';
 }
 
-my $dummy_instance = Test::Mouse::Meta::TypeConstraint::Union->new;
+my $dummy_instance = Test::Mouse::Meta::TypeConstraint->new;
 
 ok $dummy_instance => "Created Instance";
 
 isa_ok $dummy_instance,
-    'Test::Mouse::Meta::TypeConstraint::Union' => 'isa correct type';
+    'Test::Mouse::Meta::TypeConstraint' => 'isa correct type';
 
 is "$dummy_instance", "Broken|Test" =>
     'Got expected stringification result';
@@ -65,3 +70,24 @@ ok $subtype2 => 'made a subtype of our subtype';
         "correct error thrown"
     );
 }
+
+{
+    for my $t (qw(Bar Foo)) {
+        my $tc = Mouse::Meta::TypeConstraint->new({
+            name => $t,
+        });
+
+        Mouse::Util::TypeConstraints::register_type_constraint($tc);
+    }
+
+    my $foo = Mouse::Util::TypeConstraints::find_type_constraint('Foo');
+    my $bar = Mouse::Util::TypeConstraints::find_type_constraint('Bar');
+
+    ok(!$foo->equals($bar), "Foo type is not equal to Bar type");
+    ok( $foo->equals($foo), "Foo equals Foo");
+    ok( 0+$foo == refaddr($foo), "overloading works");
+}
+
+ok $subtype1, "type constraint boolean overload works";
+
+done_testing;