From: Alexander Hartmaier Date: Fri, 28 Jan 2011 14:09:29 +0000 (+0000) Subject: added test for chained dispatcher fail on multiple CaptureArgs(0) parts introduced... X-Git-Tag: 5.80031~1 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=055abad13cd2de549311b897e931d4c06d96d6fc added test for chained dispatcher fail on multiple CaptureArgs(0) parts introduced in 5.80030 --- diff --git a/t/aggregate/live_component_controller_action_chained.t b/t/aggregate/live_component_controller_action_chained.t index 7977875..20349df 100644 --- a/t/aggregate/live_component_controller_action_chained.t +++ b/t/aggregate/live_component_controller_action_chained.t @@ -847,6 +847,33 @@ sub run_tests { } # + # Complex path with multiple non-capturing pathparts + # PathPart('') CaptureArgs(0), PathPart('foo') CaptureArgs(0), PathPart('') Args(0) + # should win over PathPart('') CaptureArgs(1), PathPart('') Args(0) + # + { + my @expected = qw[ + TestApp::Controller::Action::Chained->begin + TestApp::Controller::Action::Chained->mult_nopp2_base + TestApp::Controller::Action::Chained->mult_nopp2_nocap + TestApp::Controller::Action::Chained->mult_nopp2_action + TestApp::Controller::Action::Chained->mult_nopp2_action_default + TestApp::Controller::Action::Chained->end + ]; + + my $expected = join( ", ", @expected ); + + ok( my $response = request('http://localhost/chained/mult_nopp2/action'), + "Complex path with multiple non-capturing pathparts" ); + TODO: { + local $TODO = 'Known bug'; + is( $response->header('X-Catalyst-Executed'), + $expected, 'Executed actions' ); + is( $response->content, '; ', 'Content OK' ); + } + } + + # # Higher Args() hiding more specific CaptureArgs chains sections # { diff --git a/t/lib/TestApp/Controller/Action/Chained.pm b/t/lib/TestApp/Controller/Action/Chained.pm index cbba762..a393e77 100644 --- a/t/lib/TestApp/Controller/Action/Chained.pm +++ b/t/lib/TestApp/Controller/Action/Chained.pm @@ -164,6 +164,14 @@ sub mult_nopp_id : Chained('mult_nopp_base') PathPart('') CaptureArgs(1) { } sub mult_nopp_idall : Chained('mult_nopp_id') PathPart('') Args(0) { } sub mult_nopp_idnew : Chained('mult_nopp_id') PathPart('new') Args(0) { } +sub mult_nopp2_base : Chained('/') PathPart('chained/mult_nopp2') CaptureArgs(0) { } +sub mult_nopp2_nocap : Chained('mult_nopp2_base') PathPart('') CaptureArgs(0) { } +sub mult_nopp2_action : Chained('mult_nopp2_nocap') PathPart('action') CaptureArgs(0) { } +sub mult_nopp2_action_default : Chained('mult_nopp2_action') PathPart('') Args(0) { } +sub mult_nopp2_action_with_arg : Chained('mult_nopp2_action') PathPart('') Args(1) { } +sub mult_nopp2_load : Chained('mult_nopp2_base') PathPart('') CaptureArgs(1) { } +sub mult_nopp2_view : Chained('mult_nopp2_load') PathPart('') Args(0) { } + # # Test Choice between branches and early return logic # Declaration order is important for $children->{$*}, since this is first match best.