X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F040_type_constraints%2F010_misc_type_tests.t;h=7b860469dc5b3ea07c788a549a877d08f35d5548;hb=a098a4a3fa7da540ca8235cf5ab27e37a4f35d70;hp=2cf0985ae4e17d24867c591606b2ab0b9562a1f6;hpb=c24269b37a781e0358c3682e8717cfd539269550;p=gitmo%2FMoose.git diff --git a/t/040_type_constraints/010_misc_type_tests.t b/t/040_type_constraints/010_misc_type_tests.t index 2cf0985..7b86046 100644 --- a/t/040_type_constraints/010_misc_type_tests.t +++ b/t/040_type_constraints/010_misc_type_tests.t @@ -3,8 +3,9 @@ use strict; use warnings; -use Test::More tests => 11; +use Test::More; use Test::Exception; +use Scalar::Util qw(refaddr); BEGIN { use_ok('Moose::Util::TypeConstraints'); @@ -65,3 +66,24 @@ ok $subtype2 => 'made a subtype of our subtype'; "correct error thrown" ); } + +{ + for my $t (qw(Bar Foo)) { + my $tc = Moose::Meta::TypeConstraint->new({ + name => $t, + }); + + Moose::Util::TypeConstraints::register_type_constraint($tc); + } + + my $foo = Moose::Util::TypeConstraints::find_type_constraint('Foo'); + my $bar = Moose::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;