X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMouse.git;a=blobdiff_plain;f=t%2F001_mouse%2F041-enum.t;h=8dfe9b9044603b4af6a061fbace058875d93a3b2;hp=5546f4f1f32dcbaaf3e3c3ef0f72c197d58427fe;hb=f152b0997e523b60b2dbcefff8d102fc1096bf49;hpb=ec0ef2581f45f3569dc4344a19d88b698a33f3d9 diff --git a/t/001_mouse/041-enum.t b/t/001_mouse/041-enum.t index 5546f4f..8dfe9b9 100644 --- a/t/001_mouse/041-enum.t +++ b/t/001_mouse/041-enum.t @@ -1,7 +1,7 @@ #!/usr/bin/env perl use strict; use warnings; -use Test::More tests => 16; +use Test::More tests => 19; use Test::Exception; do { @@ -38,3 +38,11 @@ for my $class ('Shirt', 'Shirt::Anon') { throws_ok { $class->new(size => ' small') } qr/^Attribute \(size\) does not pass the type constraint because: Validation failed for '\S+' failed with value small/; } +use Mouse::Util::TypeConstraints qw(enum); + +my $t = enum 'Foo', [qw(foo bar)]; + +ok $t->check('foo'), 'enum $name, $array_ref'; +ok $t->check('bar'); +ok!$t->check('baz'); +