00d24da6ca8c50eece7c7c51f287624fb751e752
[catagits/Catalyst-Runtime.git] / t / aggregate / unit_core_script_help.t
1 #!/usr/bin/env perl
2 use strict;
3 use warnings;
4 use Test::More;
5 use Test::Exception;
6
7 use FindBin qw/$Bin/;
8 use lib "$Bin/../lib";
9
10 {
11     package TestHelpScript;
12     use Moose;
13     with 'Catalyst::ScriptRole';
14     our $help;
15     sub print_usage_text { $help++ }
16 }
17
18 test('--help');
19 test('-?');
20
21 sub test {
22     local $TestHelpScript::help;
23     local @ARGV = (@_);
24     lives_ok {
25         TestHelpScript->new_with_options(application_name => 'TestAppToTestScripts')->run;
26     } 'Lives';
27     ok $TestHelpScript::help, 'Got help';
28 }
29
30 done_testing;