Unified help display, at the cost of having lost the info about what you fucked up...
[catagits/Catalyst-Runtime.git] / t / aggregate / unit_core_script_help.t
diff --git a/t/aggregate/unit_core_script_help.t b/t/aggregate/unit_core_script_help.t
new file mode 100644 (file)
index 0000000..0850fd6
--- /dev/null
@@ -0,0 +1,29 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More;
+
+use FindBin qw/$Bin/;
+use lib "$Bin/../lib";
+
+{
+    package TestHelpScript;
+    use Moose;
+    with 'Catalyst::ScriptRole';
+    our $help;
+    sub _exit_with_usage { $help++ }
+}
+{
+    local $TestHelpScript::help;
+    local @ARGV = ('-h');
+    TestHelpFromScriptCGI->new_with_options(application_name => 'TestAppToTestScripts')->run;
+    ok $TestHelpFromScriptCGI::help, 1;
+}
+{
+    local $TestHelpScript::help;
+    local @ARGV = ('--help');
+    TestHelpFromScriptCGI->new_with_options(application_name => 'TestAppToTestScripts')->run;
+    is $TestHelpFromScriptCGI::help, 2;
+}
+
+done_testing;