[Catalyst-commits] r11921 - in Catalyst-Runtime/5.80/branches/better_scripts/t: . aggregate

t0m at dev.catalyst.perl.org t0m at dev.catalyst.perl.org
Thu Nov 19 22:23:59 GMT 2009


Author: t0m
Date: 2009-11-19 22:23:58 +0000 (Thu, 19 Nov 2009)
New Revision: 11921

Added:
   Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_script_server.t
   Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_scriptrunner.t
Removed:
   Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_script_server.t
   Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_scriptrunner.t
Log:
Move to aggregate

Copied: Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_script_server.t (from rev 11920, Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_script_server.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_script_server.t	                        (rev 0)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_script_server.t	2009-11-19 22:23:58 UTC (rev 11921)
@@ -0,0 +1,89 @@
+use strict;
+use warnings;
+
+use FindBin qw/$Bin/;
+use lib "$Bin/../lib";
+
+use Test::More 'no_plan';
+use Test::Exception;
+
+use Catalyst::Script::Server;
+
+my $testopts;
+
+# Test default (no opts/args behaviour)
+testOption( [ qw// ], ['3000', 'localhost', opthash()] );
+
+# Old version supports long format opts with either one or two dashes.  New version only supports two.
+#                Old                       New
+# help           -? -help --help           -h --help
+# debug          -d -debug --debug         -d --debug
+# host           -host --host              --host
+testOption( [ qw/--host testhost/ ], ['3000', 'testhost', opthash()] );
+testOption( [ qw/-h testhost/ ], ['3000', 'testhost', opthash()] );
+
+# port           -p -port --port           -l --listen
+testOption( [ qw/-p 3001/ ], ['3001', 'localhost', opthash()] );
+testOption( [ qw/--port 3001/ ], ['3001', 'localhost', opthash()] );
+
+# fork           -f -fork --fork           -f --fork
+$testopts = opthash();
+$testopts->{fork} = 1;
+testOption( [ qw/--fork/ ], ['3000', 'localhost', $testopts] );
+testOption( [ qw/-f/ ], ['3000', 'localhost', $testopts] );
+
+# pidfile        -pidfile                  --pid --pidfile
+$testopts = opthash();
+$testopts->{pidfile} = "cat.pid";
+testOption( [ qw/--pidfile cat.pid/ ], ['3000', 'localhost', $testopts] );
+
+# keepalive      -k -keepalive --keepalive -k --keepalive
+$testopts = opthash();
+$testopts->{keepalive} = 1;
+testOption( [ qw/-k/ ], ['3000', 'localhost', $testopts] );
+testOption( [ qw/--keepalive/ ], ['3000', 'localhost', $testopts] );
+
+# symlinks       -follow_symlinks          --sym --follow_symlinks
+$testopts = opthash();
+$testopts->{follow_symlinks} = 1;
+testOption( [ qw/--follow_symlinks/ ], ['3000', 'localhost', $testopts] );
+
+# background     -background               --bg --background
+$testopts = opthash();
+$testopts->{background} = 1;
+testOption( [ qw/--background/ ], ['3000', 'localhost', $testopts] );
+
+# Restart stuff requires a threaded perl, apparently.
+# restart        -r -restart --restart     -R --restart
+# restart dly    -rd -restartdelay         --rdel --restart_delay
+# restart dir    -restartdirectory         --rdir --restart_directory
+# restart regex  -rr -restartregex         --rxp --restart_regex
+
+
+sub testOption {
+    my ($argstring, $resultarray) = @_;
+
+    subtest "Test for ARGV: @$argstring" => sub
+        {
+            plan tests => 2;
+            local @ARGV = @$argstring;
+            local @TestAppToTestScripts::RUN_ARGS;
+            lives_ok {
+                Catalyst::Script::Server->new_with_options(application_name => 'TestAppToTestScripts')->run;
+            } "new_with_options";
+            # First element of RUN_ARGS will be the script name, which we don't care about
+            shift @TestAppToTestScripts::RUN_ARGS;
+            is_deeply \@TestAppToTestScripts::RUN_ARGS, $resultarray, "is_deeply comparison";
+            done_testing;
+        };
+}
+
+# Returns the hash expected when no flags are passed
+sub opthash {
+    return { 'pidfile' => undef,
+             'fork' => 0,
+             'follow_symlinks' => 0,
+             'background' => 0,
+             'keepalive' => 0,
+         }
+}

Copied: Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_scriptrunner.t (from rev 11920, Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_scriptrunner.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_scriptrunner.t	                        (rev 0)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/aggregate/unit_core_scriptrunner.t	2009-11-19 22:23:58 UTC (rev 11921)
@@ -0,0 +1,16 @@
+use strict;
+use warnings;
+use Test::More tests => 5;
+use FindBin qw/$Bin/;
+use lib "$Bin/../lib";
+
+use_ok('Catalyst::ScriptRunner');
+
+is Catalyst::ScriptRunner->run('ScriptTestApp', 'Foo'), 'ScriptTestApp::Script::Foo',
+    'Script existing only in app';
+is Catalyst::ScriptRunner->run('ScriptTestApp', 'Bar'), 'ScriptTestApp::Script::Bar',
+    'Script existing in both app and Catalyst - prefers app';
+is Catalyst::ScriptRunner->run('ScriptTestApp', 'Baz'), 'Catalyst::Script::Baz',
+    'Script existing only in Catalyst';
+# +1 test for the params passed to new_with_options in t/lib/Catalyst/Script/Baz.pm
+

Deleted: Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_script_server.t
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_script_server.t	2009-11-19 22:16:12 UTC (rev 11920)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_script_server.t	2009-11-19 22:23:58 UTC (rev 11921)
@@ -1,89 +0,0 @@
-use strict;
-use warnings;
-
-use FindBin qw/$Bin/;
-use lib "$Bin/lib";
-
-use Test::More 'no_plan';
-use Test::Exception;
-
-use Catalyst::Script::Server;
-
-my $testopts;
-
-# Test default (no opts/args behaviour)
-testOption( [ qw// ], ['3000', 'localhost', opthash()] );
-
-# Old version supports long format opts with either one or two dashes.  New version only supports two.
-#                Old                       New
-# help           -? -help --help           -h --help
-# debug          -d -debug --debug         -d --debug
-# host           -host --host              --host
-testOption( [ qw/--host testhost/ ], ['3000', 'testhost', opthash()] );
-testOption( [ qw/-h testhost/ ], ['3000', 'testhost', opthash()] );
-
-# port           -p -port --port           -l --listen
-testOption( [ qw/-p 3001/ ], ['3001', 'localhost', opthash()] );
-testOption( [ qw/--port 3001/ ], ['3001', 'localhost', opthash()] );
-
-# fork           -f -fork --fork           -f --fork
-$testopts = opthash();
-$testopts->{fork} = 1;
-testOption( [ qw/--fork/ ], ['3000', 'localhost', $testopts] );
-testOption( [ qw/-f/ ], ['3000', 'localhost', $testopts] );
-
-# pidfile        -pidfile                  --pid --pidfile
-$testopts = opthash();
-$testopts->{pidfile} = "cat.pid";
-testOption( [ qw/--pidfile cat.pid/ ], ['3000', 'localhost', $testopts] );
-
-# keepalive      -k -keepalive --keepalive -k --keepalive
-$testopts = opthash();
-$testopts->{keepalive} = 1;
-testOption( [ qw/-k/ ], ['3000', 'localhost', $testopts] );
-testOption( [ qw/--keepalive/ ], ['3000', 'localhost', $testopts] );
-
-# symlinks       -follow_symlinks          --sym --follow_symlinks
-$testopts = opthash();
-$testopts->{follow_symlinks} = 1;
-testOption( [ qw/--follow_symlinks/ ], ['3000', 'localhost', $testopts] );
-
-# background     -background               --bg --background
-$testopts = opthash();
-$testopts->{background} = 1;
-testOption( [ qw/--background/ ], ['3000', 'localhost', $testopts] );
-
-# Restart stuff requires a threaded perl, apparently.
-# restart        -r -restart --restart     -R --restart
-# restart dly    -rd -restartdelay         --rdel --restart_delay
-# restart dir    -restartdirectory         --rdir --restart_directory
-# restart regex  -rr -restartregex         --rxp --restart_regex
-
-
-sub testOption {
-    my ($argstring, $resultarray) = @_;
-
-    subtest "Test for ARGV: @$argstring" => sub
-        {
-            plan tests => 2;
-            local @ARGV = @$argstring;
-            local @TestAppToTestScripts::RUN_ARGS;
-            lives_ok {
-                Catalyst::Script::Server->new_with_options(application_name => 'TestAppToTestScripts')->run;
-            } "new_with_options";
-            # First element of RUN_ARGS will be the script name, which we don't care about
-            shift @TestAppToTestScripts::RUN_ARGS;
-            is_deeply \@TestAppToTestScripts::RUN_ARGS, $resultarray, "is_deeply comparison";
-            done_testing;
-        };
-}
-
-# Returns the hash expected when no flags are passed
-sub opthash {
-    return { 'pidfile' => undef,
-             'fork' => 0,
-             'follow_symlinks' => 0,
-             'background' => 0,
-             'keepalive' => 0,
-         }
-}

Deleted: Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_scriptrunner.t
===================================================================
--- Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_scriptrunner.t	2009-11-19 22:16:12 UTC (rev 11920)
+++ Catalyst-Runtime/5.80/branches/better_scripts/t/unit_core_scriptrunner.t	2009-11-19 22:23:58 UTC (rev 11921)
@@ -1,16 +0,0 @@
-use strict;
-use warnings;
-use Test::More tests => 5;
-use FindBin qw/$Bin/;
-use lib "$Bin/lib";
-
-use_ok('Catalyst::ScriptRunner');
-
-is Catalyst::ScriptRunner->run('ScriptTestApp', 'Foo'), 'ScriptTestApp::Script::Foo',
-    'Script existing only in app';
-is Catalyst::ScriptRunner->run('ScriptTestApp', 'Bar'), 'ScriptTestApp::Script::Bar',
-    'Script existing in both app and Catalyst - prefers app';
-is Catalyst::ScriptRunner->run('ScriptTestApp', 'Baz'), 'Catalyst::Script::Baz',
-    'Script existing only in Catalyst';
-# +1 test for the params passed to new_with_options in t/lib/Catalyst/Script/Baz.pm
-




More information about the Catalyst-commits mailing list