File: unit_core_script_help.t

package info (click to toggle)
libcatalyst-perl 5.90132-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,016 kB
  • sloc: perl: 11,061; makefile: 7
file content (32 lines) | stat: -rw-r--r-- 579 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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 print_usage_text { $help++ }
}

test('--help');
test('-?');

sub test {
    local $TestHelpScript::help;
    local @ARGV = (@_);
    is exception {
        TestHelpScript->new_with_options(application_name => 'TestAppToTestScripts')->run;
    }, undef, 'Lives';
    ok $TestHelpScript::help, 'Got help';
}

done_testing;