Make the MM::TC::Role type object's parent Object rather than the
[gitmo/Moose.git] / t / 040_type_constraints / 015_enum.t
index a0b7851..162905e 100644 (file)
@@ -31,7 +31,7 @@ push @invalid_metacharacters, '^1?$|^(11+?)\1+$';
 plan tests => @valid_letters        + @invalid_letters
             + @valid_languages      + @invalid_languages
             + @valid_metacharacters + @invalid_metacharacters
-            + @valid_languages      + 3;
+            + @valid_languages      + 10;
 
 Moose::Util::TypeConstraints->export_type_constraints_as_functions();
 
@@ -56,4 +56,13 @@ is($anon_enum->parent->name, 'Str', '... got the right parent name');
 ok($anon_enum->check($_), "'$_' is a language") for @valid_languages;
 
 
+ok( !$anon_enum->equals( enum [qw(foo bar)] ), "doesn't equal a diff enum" );
+ok( $anon_enum->equals( $anon_enum ), "equals itself" );
+ok( $anon_enum->equals( enum \@valid_languages ), "equals duplicate" );
+
+ok( !$anon_enum->is_subtype_of('Object'), 'enum not a subtype of Object');
+ok( !$anon_enum->is_a_type_of('Object'), 'enum not type of Object');
+
+ok( !$anon_enum->is_subtype_of('ThisTypeDoesNotExist'), 'enum not a subtype of nonexistant type');
+ok( !$anon_enum->is_a_type_of('ThisTypeDoesNotExist'), 'enum not type of nonexistant type');