10 use Catalyst::Script::FastCGI;
14 # Test default (no opts/args behaviour)
15 testOption( [ qw// ], [undef, opthash()] );
18 testOption( [ qw|-l /tmp/foo| ], ['/tmp/foo', opthash()] );
19 testOption( [ qw/-l 127.0.0.1:3000/ ], ['127.0.0.1:3000', opthash()] );
21 #daemonize -d --daemon
22 testOption( [ qw/-d/ ], [undef, opthash(detach => 1)] );
23 testOption( [ qw/--daemon/ ], [undef, opthash(detach => 1)] );
25 # pidfile -pidfile -p --pid --pidfile
26 testOption( [ qw/--pidfile cat.pid/ ], [undef, opthash(pidfile => 'cat.pid')] );
27 testOption( [ qw/--pid cat.pid/ ], [undef, opthash(pidfile => 'cat.pid')] );
28 testOption( [ qw/-p cat.pid/ ], [undef, opthash(pidfile => 'cat.pid')] );
31 testOption( [ qw/--manager foo::bar/ ], [undef, opthash(manager => 'foo::bar')] );
32 testOption( [ qw/-M foo::bar/ ], [undef, opthash(manager => 'foo::bar')] );
35 testOption( [ qw/--keeperr/ ], [undef, opthash(keep_stderr => 1)] );
36 testOption( [ qw/-e/ ], [undef, opthash(keep_stderr => 1)] );
39 testOption( [ qw/--nproc 6/ ], [undef, opthash(nproc => 6)] );
40 testOption( [ qw/--n 6/ ], [undef, opthash(nproc => 6)] );
45 my ($argstring, $resultarray) = @_;
47 local @ARGV = @$argstring;
48 local @TestAppToTestScripts::RUN_ARGS;
50 Catalyst::Script::FastCGI->new_with_options(application_name => 'TestAppToTestScripts')->run;
52 # First element of RUN_ARGS will be the script name, which we don't care about
53 shift @TestAppToTestScripts::RUN_ARGS;
54 is_deeply \@TestAppToTestScripts::RUN_ARGS, $resultarray, "is_deeply comparison";
57 # Returns the hash expected when no flags are passed