[Catalyst-commits] r8231 - in Catalyst-Runtime/5.70/trunk/t: . lib/TestApp/Controller/Action

matthewt at dev.catalyst.perl.org matthewt at dev.catalyst.perl.org
Mon Aug 18 13:02:55 BST 2008


Author: matthewt
Date: 2008-08-18 13:02:54 +0100 (Mon, 18 Aug 2008)
New Revision: 8231

Modified:
   Catalyst-Runtime/5.70/trunk/t/lib/TestApp/Controller/Action/Chained.pm
   Catalyst-Runtime/5.70/trunk/t/live_component_controller_action_chained.t
Log:
merge rafl's test

Modified: Catalyst-Runtime/5.70/trunk/t/lib/TestApp/Controller/Action/Chained.pm
===================================================================
--- Catalyst-Runtime/5.70/trunk/t/lib/TestApp/Controller/Action/Chained.pm	2008-08-18 04:23:58 UTC (rev 8230)
+++ Catalyst-Runtime/5.70/trunk/t/lib/TestApp/Controller/Action/Chained.pm	2008-08-18 12:02:54 UTC (rev 8231)
@@ -175,6 +175,16 @@
 sub cc_b_link	: Chained('cc_b') 	 	PathPart('') 				CaptureArgs(1) { }
 sub cc_b_anchor	: Chained('cc_b_link')  PathPart('anchor.html') 	Args() 		   { }
 
+#
+#   Test static paths vs. captures
+#
+
+sub apan        : Chained('/')     CaptureArgs(0) PathPrefix   { }
+sub korv        : Chained('apan')  CaptureArgs(0) PathPart('') { }
+sub wurst       : Chained('apan')  CaptureArgs(1) PathPart('') { }
+sub static_end  : Chained('korv')  Args(0)                     { }
+sub capture_end : Chained('wurst') Args(0)        PathPart('') { }
+
 sub end :Private {
   my ($self, $c) = @_;
   return if $c->stash->{no_end};

Modified: Catalyst-Runtime/5.70/trunk/t/live_component_controller_action_chained.t
===================================================================
--- Catalyst-Runtime/5.70/trunk/t/live_component_controller_action_chained.t	2008-08-18 04:23:58 UTC (rev 8230)
+++ Catalyst-Runtime/5.70/trunk/t/live_component_controller_action_chained.t	2008-08-18 12:02:54 UTC (rev 8231)
@@ -10,7 +10,7 @@
 
 BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
 
-use Test::More tests => 136*$iters;
+use Test::More tests => 138*$iters;
 use Catalyst::Test 'TestApp';
 
 if ( $ENV{CAT_BENCHMARK} ) {
@@ -945,4 +945,23 @@
         is( $response->content, '; 1', 'Content OK' );
     }
 
+    #
+    #   static paths vs. captures
+    #
+    {
+        my @expected = qw[
+            TestApp::Controller::Action::Chained->begin
+            TestApp::Controller::Action::Chained->apan
+            TestApp::Controller::Action::Chained->korv
+            TestApp::Controller::Action::Chained->static_end
+            TestApp::Controller::Action::Chained->end
+        ];
+
+        my $expected = join( ", ", @expected );
+
+        ok( my $response = request('http://localhost/action/chained/static_end'),
+            "static paths are prefered over captures" );
+        is( $response->header('X-Catalyst-Executed'),
+            $expected, 'Executed actions' );
+    }
 }




More information about the Catalyst-commits mailing list