From: John Napiorkowski Date: Thu, 12 Mar 2015 20:50:16 +0000 (-0500) Subject: fix typo and update test X-Git-Tag: 5.90089_002~45 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=e5604544417cca5a4d837b7220d3f0fdd7767f3a fix typo and update test --- diff --git a/lib/Catalyst/Action.pm b/lib/Catalyst/Action.pm index ca4996a..58693af 100644 --- a/lib/Catalyst/Action.pm +++ b/lib/Catalyst/Action.pm @@ -134,6 +134,7 @@ sub execute { sub match { my ( $self, $c ) = @_; + $c->log->debug($self->reverse); # If infinite args, we always match return 1 if $self->normalized_arg_number == ~0; @@ -149,7 +150,7 @@ sub match { ) { return $self->args_constraints->[0]->check($c->req->args); } else { - for my $i($#{ $c->req->args }) { + for my $i(0..$#{ $c->req->args }) { $self->args_constraints->[$i]->check($c->req->args->[$i]) || return 0; } return 1; diff --git a/t/arg_constraints.t b/t/arg_constraints.t index 5e3a235..20ff1ba 100644 --- a/t/arg_constraints.t +++ b/t/arg_constraints.t @@ -22,6 +22,9 @@ use HTTP::Request::Common; $c->res->body('many_ints'); } + sub int_priority :Path('priority_test') Args(Int) { $_[1]->res->body('int_priority') } + sub any_priority :Path('priority_test') Args(1) { $_[1]->res->body('any_priority') } + sub default :Default { my ($self, $c, $int) = @_; $c->res->body('default'); @@ -32,6 +35,7 @@ use HTTP::Request::Common; package MyApp; use Catalyst; + #MyApp->config(show_internal_actions => 1); MyApp->setup; } @@ -67,5 +71,14 @@ use Catalyst::Test 'MyApp'; is $res->content, 'default'; } +{ + my $res = request '/priority_test/1'; + is $res->content, 'int_priority'; +} +{ + my $res = request '/priority_test/a'; + is $res->content, 'any_priority'; +} + done_testing;