[Bps-public-commit] r16785 - in Path-Dispatcher/trunk: t

sartak at bestpractical.com sartak at bestpractical.com
Sun Nov 9 12:45:23 EST 2008


Author: sartak
Date: Sun Nov  9 12:45:23 2008
New Revision: 16785

Modified:
   Path-Dispatcher/trunk/   (props changed)
   Path-Dispatcher/trunk/t/103-input.t

Log:
 r75355 at onn:  sartak | 2008-11-09 12:43:08 -0500
 t/103-input test fixes


Modified: Path-Dispatcher/trunk/t/103-input.t
==============================================================================
--- Path-Dispatcher/trunk/t/103-input.t	(original)
+++ Path-Dispatcher/trunk/t/103-input.t	Sun Nov  9 12:45:23 2008
@@ -2,12 +2,42 @@
 use strict;
 use warnings;
 use Test::More tests => 1;
-use lib 't/lib';
-use Path::Dispatcher::Test::App;
 
-our @calls;
+my @calls;
 
-Path::Dispatcher::Test::App->run('args', 1..3);
+do {
+    package MyFramework::Dispatcher;
+    use Path::Dispatcher::Declarative -base;
+
+    on qr/a(rg)s/ => sub {
+        push @calls, {
+            from => "framework",
+            args => [@_],
+            it   => $_,
+            one  => $1,
+            two  => $2,
+        };
+    };
+
+    package MyApp::Dispatcher;
+    # this hack is here because "use" expects there to be a file for the module
+    BEGIN { MyFramework::Dispatcher->import("-base") }
+
+    on qr/ar(g)s/ => sub {
+        push @calls, {
+            from => "app",
+            args => [@_],
+            it   => $_,
+            one  => $1,
+            two  => $2,
+        };
+        next_rule;
+    };
+
+    redispatch_to('MyFramework::Dispatcher');
+};
+
+MyApp::Dispatcher->run('args', 1..3);
 is_deeply([splice @calls], [
     {
         from => 'app',
@@ -18,7 +48,7 @@
     },
     {
         from => 'framework',
-        one  => 'g',
+        one  => 'rg',
         two  => undef,
         it   => 'args',
         args => [1, 2, 3],



More information about the Bps-public-commit mailing list