From: Dave Rolsky Date: Sun, 23 Jan 2011 18:03:08 +0000 (-0600) Subject: test empty path part X-Git-Tag: 0.01~19 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalystX-Routes.git;a=commitdiff_plain;h=ba806aaf3971befc46201ada7e9b206219eb9512 test empty path part --- diff --git a/t/lib/MyApp1/Controller/C1.pm b/t/lib/MyApp1/Controller/C1.pm index 2b53f62..23e315e 100644 --- a/t/lib/MyApp1/Controller/C1.pm +++ b/t/lib/MyApp1/Controller/C1.pm @@ -50,6 +50,17 @@ get 'baz' => args 1 => sub { $REQ{baz} = $_[2] }; +chain_point '_set_user' + => chained '/' + => path_part 'user' + => capture_args 1 + => sub { $REQ{user} = $_[2] }; + +get '' + => chained '_set_user' + => args 0 + => sub { $REQ{empty} = $REQ{user} }; + sub normal : Chained('/') : Args(0) { $REQ{normal}++; } diff --git a/t/routes.t b/t/routes.t index 25591bc..3ffb66c 100644 --- a/t/routes.t +++ b/t/routes.t @@ -101,6 +101,20 @@ use HTTP::Request::Common qw( GET PUT POST DELETE ); } { + get('/user/99'); + + is( + $MyApp1::Controller::C1::REQ{user}, 99, + 'get /user/99 calls _set_user chain point' + ); + + is( + $MyApp1::Controller::C1::REQ{empty}, 99, + 'get /user/99 calls get chained from _set_user' + ); +} + +{ get('/normal'); is(