X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F104_override_usage.t;h=8e7a1ff842d173694ae4a2453a51d1c394940fce;hb=c885acae4797dc3ce50e91445ceb96c971e87671;hp=d3d08685d979d546173ec122d974da53c058531d;hpb=81b19ed83c9e345f960ccefbcd639dd0e3c2de06;p=gitmo%2FMooseX-Getopt.git diff --git a/t/104_override_usage.t b/t/104_override_usage.t index d3d0868..8e7a1ff 100644 --- a/t/104_override_usage.t +++ b/t/104_override_usage.t @@ -1,7 +1,7 @@ use strict; use warnings; use Test::More 0.88; -use Test::Exception; +use Test::Trap; { package MyScript; @@ -29,13 +29,15 @@ use Test::Exception; { local $MyScript::usage; local @MyScript::warnings; local @MyScript::exception; local @ARGV = ('--help'); - throws_ok { MyScript->new_with_options } qr/A foo/; + trap { MyScript->new_with_options }; + like($trap->stdout, qr/A foo/); is $MyScript::usage, 1; } { local $MyScript::usage; local @MyScript::warnings; local @MyScript::exception; local @ARGV = ('-q'); # Does not exist - throws_ok { MyScript->new_with_options } qr/A foo/; + trap { MyScript->new_with_options }; + like($trap->die, qr/A foo/); is_deeply \@MyScript::warnings, [ 'Unknown option: q '