use strict;
use warnings;
use Test::More;
+use Test::Exception;
use FindBin qw/$Bin/;
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;