X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Flib%2FTestApp%2FController%2FAction%2FChained.pm;h=4c02130cd040caee6567f6b123797fa337e435a6;hb=9868e0a0023cc8b598d60f150ea367e0056a65f3;hp=a393e7794d439f48ce93c5a331ad589f792ac4af;hpb=055abad13cd2de549311b897e931d4c06d96d6fc;p=catagits%2FCatalyst-Runtime.git diff --git a/t/lib/TestApp/Controller/Action/Chained.pm b/t/lib/TestApp/Controller/Action/Chained.pm index a393e77..4c02130 100644 --- a/t/lib/TestApp/Controller/Action/Chained.pm +++ b/t/lib/TestApp/Controller/Action/Chained.pm @@ -20,7 +20,7 @@ sub begin :Private { } sub foo :PathPart('chained/foo') :CaptureArgs(1) :Chained('/') { my ( $self, $c, @args ) = @_; die "missing argument" unless @args; - die "more than 1 argument" if @args > 1; + die "more than 1 argument: got @args" if @args > 1; } sub endpoint :PathPart('end') :Chained('/action/chained/foo') :Args(1) { } @@ -143,6 +143,24 @@ sub chain_dt_a :Chained :PathPart('chained/chain_dt') :CaptureArgs(1) { sub chain_dt_b :Chained('chain_dt_a') :PathPart('end') :Args(1) { } # +# Error in the middle of a chain +# +sub chain_error_a :Chained :PathPart('chained/chain_error') :CaptureArgs(1) { + $_[1]->error( 'break in the middle of a chain' ); +} + +sub chain_error_b :Chained('chain_error_a') :PathPart('end') :Args(1) {} + +# +# Die in the middle of a chain +# +sub chain_die_a :Chained :PathPart('chained/chain_die') :CaptureArgs(1) { + die( "die in the middle of a chain\n" ); +} + +sub chain_die_b :Chained('chain_die_a') :PathPart('end') :Args(1) {} + +# # Target for former forward and chain tests. # sub fw_dt_target :Private { } @@ -220,6 +238,13 @@ sub roundtrip_urifor_end : Chained('roundtrip_urifor') PathPart('') Args(1) { $c->stash->{no_end} = 1; } +sub match_captures : Chained('/') PathPart('chained/match_captures') CaptureArgs(1) ActionClass('+TestApp::Action::TestMatchCaptures') { + my ($self, $c) = @_; + $c->res->header( 'X-TestAppActionTestMatchCapturesHasRan', 'yes'); +} + +sub match_captures_end : Chained('match_captures') PathPart('bar') Args(0) { } + sub end :Private { my ($self, $c) = @_; return if $c->stash->{no_end};