From: Karen Etheridge Date: Sun, 23 Dec 2012 19:58:19 +0000 (-0800) Subject: use Test::Fatal to test this exception X-Git-Tag: v0.48~4 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=38a138f78268e249f0de2391d4499b98a36dadb8;hp=66ee5b17ce7666667d3a4bd9d0a4026e57d4a4da;p=gitmo%2FMooseX-Getopt.git use Test::Fatal to test this exception --- diff --git a/t/002_custom_option_type.t b/t/002_custom_option_type.t index 11cf709..596a5f9 100644 --- a/t/002_custom_option_type.t +++ b/t/002_custom_option_type.t @@ -3,6 +3,7 @@ use warnings; use Test::More tests => 7; use Test::NoWarnings 1.04 ':early'; +use Test::Fatal; BEGIN { use_ok('MooseX::Getopt'); @@ -53,9 +54,11 @@ BEGIN { # 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'); +like( + exception { + local @ARGV = ('--nums', 3, '--nums', 'foo'); + my $app = App->new_with_options; + }, + qr/Value "foo" invalid/, + 'Numeric constraint enforced', +);