$args{parent} = Moose::Util::TypeConstraints::find_type_constraint('Str');
$args{inlined} = $inliner;
- if ( scalar @{ $args{values} } < 2 ) {
+ if ( scalar @{ $args{values} } < 1 ) {
require Moose;
- Moose->throw_error("You must have at least two values to enumerate through");
+ Moose->throw_error("You must have at least one value to enumerate through");
}
for (@{ $args{values} }) {
ok( !$anon_enum->is_a_type_of('ThisTypeDoesNotExist'), 'enum not type of nonexistant type');
# validation
-like( exception { Moose::Meta::TypeConstraint::Enum->new(name => 'ZeroValues', values => []) }, qr/You must have at least two values to enumerate through/ );
+like( exception { Moose::Meta::TypeConstraint::Enum->new(name => 'ZeroValues', values => []) }, qr/You must have at least one value to enumerate through/ );
-like( exception { Moose::Meta::TypeConstraint::Enum->new(name => 'OneValue', values => [ 'a' ]) }, qr/You must have at least two values to enumerate through/ );
+is( exception { Moose::Meta::TypeConstraint::Enum->new(name => 'OneValue', values => [ 'a' ]) }, undef);
like( exception { Moose::Meta::TypeConstraint::Enum->new(name => 'ReferenceInEnum', values => [ 'a', {} ]) }, qr/Enum values must be strings, not 'HASH\(0x\w+\)'/ );