Commit | Line | Data |
---|---|---|
4f0612fd | 1 | use strict; |
2 | use warnings; | |
3 | use Test::More; | |
2a56ace9 | 4 | use Test::Fatal; |
4f0612fd | 5 | |
6 | use FindBin qw/$Bin/; | |
7 | use lib "$Bin/../lib"; | |
8 | ||
1b9bb641 | 9 | no warnings 'once'; |
10 | *CORE::GLOBAL::exit = sub {}; | |
11 | ||
4f0612fd | 12 | { |
13 | package TestHelpScript; | |
14 | use Moose; | |
15 | with 'Catalyst::ScriptRole'; | |
16 | our $help; | |
8ba29999 | 17 | sub print_usage_text { $help++ } |
4f0612fd | 18 | } |
fb533ac3 | 19 | |
fb533ac3 | 20 | test('--help'); |
3a8c155f | 21 | test('-?'); |
fb533ac3 | 22 | |
23 | sub test { | |
4f0612fd | 24 | local $TestHelpScript::help; |
fb533ac3 | 25 | local @ARGV = (@_); |
2a56ace9 | 26 | is exception { |
fb533ac3 | 27 | TestHelpScript->new_with_options(application_name => 'TestAppToTestScripts')->run; |
2a56ace9 | 28 | }, undef, 'Lives'; |
3a8c155f | 29 | ok $TestHelpScript::help, 'Got help'; |
4f0612fd | 30 | } |
31 | ||
32 | done_testing; |