X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F002_custom_option_type.t;fp=t%2F002_custom_option_type.t;h=fc4625051984f0dc2afaff64af9cb38f2b82aef9;hb=f63e631037a9d743d874ae465e8b0a8d541c16c2;hp=881b0f6ee5676f3665c15dcffcca436615cc4ade;hpb=23575d4623f4f5357c62c5f5ff57053abf357e35;p=gitmo%2FMooseX-Getopt.git diff --git a/t/002_custom_option_type.t b/t/002_custom_option_type.t index 881b0f6..fc46250 100644 --- a/t/002_custom_option_type.t +++ b/t/002_custom_option_type.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => 5; +use Test::More tests => 6; BEGIN { use_ok('MooseX::Getopt'); @@ -52,3 +52,12 @@ BEGIN { is_deeply($app->nums, [3, 5], '... nums is [3, 5] as expected'); } +# Make sure it really used our =i@, instead of falling back +# to =s@ via the type system, and test that exceptions work +# while we're at it. +eval { + local @ARGV = ('--nums', 3, '--nums', 'foo'); + + my $app = App->new_with_options; +}; +like($@, qr/Value "foo" invalid/, 'Numeric constraint enforced');