From: Tomas Doran Date: Thu, 17 Sep 2009 22:10:46 +0000 (+0000) Subject: Meh, that shows what I mean. This can be done waaaay more elegantly by abstracting... X-Git-Tag: 5.80014_02~55 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=60b86a55d91b58f9dc0771358034281096ccd418 Meh, that shows what I mean. This can be done waaaay more elegantly by abstracting the testing logic.. --- diff --git a/t/lib/TestAppToTestScripts.pm b/t/lib/TestAppToTestScripts.pm index 8102203..f32154a 100644 --- a/t/lib/TestAppToTestScripts.pm +++ b/t/lib/TestAppToTestScripts.pm @@ -1,12 +1,12 @@ package TestAppToTestScripts; use strict; use warnings; +use Carp; -our %RUN_ARGS; +our @RUN_ARGS; sub run { - my ($class, %opts) = @_; - %RUN_ARGS = %opts; + @RUN_ARGS = @_; 1; # Does this work? } diff --git a/t/unit_core_script_server.t b/t/unit_core_script_server.t new file mode 100644 index 0000000..dc46372 --- /dev/null +++ b/t/unit_core_script_server.t @@ -0,0 +1,46 @@ +use strict; +use warnings; + +use FindBin qw/$Bin/; +use lib "$Bin/lib"; + +use Test::More 'no_plan'; +use Test::Exception; + +use Catalyst::Script::Server; + +{ + local @ARGV; # Blank + local @TestAppToTestScripts::RUN_ARGS; + lives_ok { + Catalyst::Script::Server->new_with_options(application_name => 'TestAppToTestScripts')->run; + }; + is_deeply \@TestAppToTestScripts::RUN_ARGS, ['TestAppToTestScripts', + '3000', + 'localhost', + { + 'pidfile' => undef, + 'fork' => undef, + 'follow_symlinks' => undef, + 'background' => undef, + 'keepalive' => undef + }]; +} + +{ + local @ARGV = qw/-p 3001/; + local @TestAppToTestScripts::RUN_ARGS; + lives_ok { + Catalyst::Script::Server->new_with_options(application_name => 'TestAppToTestScripts')->run; + }; + is_deeply \@TestAppToTestScripts::RUN_ARGS, ['TestAppToTestScripts', + '3001', + 'localhost', + { + 'pidfile' => undef, + 'fork' => undef, + 'follow_symlinks' => undef, + 'background' => undef, + 'keepalive' => undef + }]; +}