X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=t%2Farg_constraints.t;h=20ff1baf18217d64b73fad55e2944d74a28d79d9;hp=0be8fb89ea2cc5c4b5882ffc22b7ae167671b23f;hb=e5604544417cca5a4d837b7220d3f0fdd7767f3a;hpb=6d62355b6e08f1234fefbdebaacc9ced07b0bc6c diff --git a/t/arg_constraints.t b/t/arg_constraints.t index 0be8fb8..20ff1ba 100644 --- a/t/arg_constraints.t +++ b/t/arg_constraints.t @@ -14,10 +14,17 @@ use HTTP::Request::Common; sub an_int :Local Args(Int) { my ($self, $c, $int) = @_; - #use Devel::Dwarn; Dwarn $self; $c->res->body('an_int'); } + sub many_ints :Local Args(ArrayRef[Int]) { + my ($self, $c, $int) = @_; + $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'); @@ -28,6 +35,7 @@ use HTTP::Request::Common; package MyApp; use Catalyst; + #MyApp->config(show_internal_actions => 1); MyApp->setup; } @@ -43,4 +51,34 @@ use Catalyst::Test 'MyApp'; is $res->content, 'default'; } +{ + my $res = request '/many_ints/1'; + is $res->content, 'many_ints'; +} + +{ + my $res = request '/many_ints/1/2'; + is $res->content, 'many_ints'; +} + +{ + my $res = request '/many_ints/1/2/3'; + is $res->content, 'many_ints'; +} + +{ + my $res = request '/many_ints/1/2/a'; + 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; +