X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Faggregate%2Funit_core_script_help.t;h=38eb5ead5859b2f3cde92f8897ac25aa9308ea9c;hb=4e93cdb6d9403718baff430bc1bdc3245aa5236f;hp=0850fd6d4ae205a5e21c99cc068c443ae2576409;hpb=4f0612fdbc3922b6b32f9f30269849a51995b4f3;p=catagits%2FCatalyst-Runtime.git diff --git a/t/aggregate/unit_core_script_help.t b/t/aggregate/unit_core_script_help.t index 0850fd6..38eb5ea 100644 --- a/t/aggregate/unit_core_script_help.t +++ b/t/aggregate/unit_core_script_help.t @@ -1,29 +1,32 @@ -#!/usr/bin/env perl use strict; use warnings; use Test::More; +use Test::Fatal; use FindBin qw/$Bin/; use lib "$Bin/../lib"; +no warnings 'once'; +*CORE::GLOBAL::exit = sub {}; + { package TestHelpScript; use Moose; with 'Catalyst::ScriptRole'; our $help; - sub _exit_with_usage { $help++ } -} -{ - local $TestHelpScript::help; - local @ARGV = ('-h'); - TestHelpFromScriptCGI->new_with_options(application_name => 'TestAppToTestScripts')->run; - ok $TestHelpFromScriptCGI::help, 1; + sub print_usage_text { $help++ } } -{ + +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 = (@_); + is exception { + TestHelpScript->new_with_options(application_name => 'TestAppToTestScripts')->run; + }, undef, 'Lives'; + ok $TestHelpScript::help, 'Got help'; } done_testing;