DEATH TO ALL zionist ELLIPSES
[gitmo/Moose.git] / t / 040_type_constraints / 015_enum.t
index a0b7851..9286794 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();
 
@@ -50,10 +50,19 @@ ok(!Metacharacter($_), "'$_' is not a metacharacter")
 my $anon_enum = enum \@valid_languages;
 isa_ok($anon_enum, 'Moose::Meta::TypeConstraint');
 
-is($anon_enum->name, '__ANON__', '... got the right name');
-is($anon_enum->parent->name, 'Str', '... got the right parent name');
+is($anon_enum->name, '__ANON__', 'got the right name');
+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');