X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=t%2Faggregate%2Funit_core_script_help.t;h=d3a6fabd8981d11760528214d1e596d4cdb03fd2;hp=0850fd6d4ae205a5e21c99cc068c443ae2576409;hb=9c74923de2304b8c8f0a7a2faa0854ad9b4d3a92;hpb=4f0612fdbc3922b6b32f9f30269849a51995b4f3 diff --git a/t/aggregate/unit_core_script_help.t b/t/aggregate/unit_core_script_help.t index 0850fd6..d3a6fab 100644 --- a/t/aggregate/unit_core_script_help.t +++ b/t/aggregate/unit_core_script_help.t @@ -2,6 +2,7 @@ use strict; use warnings; use Test::More; +use Test::Exception; use FindBin qw/$Bin/; use lib "$Bin/../lib"; @@ -11,19 +12,19 @@ use lib "$Bin/../lib"; use Moose; with 'Catalyst::ScriptRole'; our $help; - sub _exit_with_usage { $help++ } + sub _getopt_full_usage { $help++ } } -{ - local $TestHelpScript::help; - local @ARGV = ('-h'); - TestHelpFromScriptCGI->new_with_options(application_name => 'TestAppToTestScripts')->run; - ok $TestHelpFromScriptCGI::help, 1; -} -{ + +test('--help'); +test('-?'); + +sub test { local $TestHelpScript::help; - local @ARGV = ('--help'); - TestHelpFromScriptCGI->new_with_options(application_name => 'TestAppToTestScripts')->run; - is $TestHelpFromScriptCGI::help, 2; + local @ARGV = (@_); + lives_ok { + TestHelpScript->new_with_options(application_name => 'TestAppToTestScripts')->run; + } 'Lives'; + ok $TestHelpScript::help, 'Got help'; } done_testing;