Fix test
[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     __PACKAGE__->meta->get_attribute('help')->cmd_aliases('h');
15     our $help;
16     sub _exit_with_usage { $help++ }
17 }
18
19 test('-h');
20 test('--help');
21
22 TODO: {
23     local $TODO = 'This is bork';
24     test('-?');
25 }
26
27 sub test {
28     local $TestHelpScript::help;
29     local @ARGV = (@_);
30     lives_ok {
31         TestHelpScript->new_with_options(application_name => 'TestAppToTestScripts')->run;
32     };
33     ok $TestHelpScript::help;
34 }
35
36 done_testing;