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=c1e3733ce9c95e30ae4032c4ee9de1bb22efe185;hp=a8e8ae27b429698b78937bfbf0ffe7a46403ad39;hb=b87b8e45858c2e39d7322e17dd045925b56c7e6c;hpb=fc036112266c785163c051608821d66f42757ed3 diff --git a/t/arg_constraints.t b/t/arg_constraints.t index a8e8ae2..c1e3733 100644 --- a/t/arg_constraints.t +++ b/t/arg_constraints.t @@ -203,7 +203,7 @@ BEGIN { use Moose; use MooseX::MethodAttributes; - use namespace::autoclean; + use namespace::autoclean -except => 'Int'; use MyApp::Types qw/Int/; @@ -221,19 +221,39 @@ BEGIN { use Moose::Role; use MooseX::MethodAttributes::Role; + use MyApp::Types qw/Int/; sub an_int :Local Args(Int) { my ($self, $c, $int) = @_; $c->res->body('an_int (withrole)'); } + sub an_int_ns :Local Args(MyApp::Types::Int) { + my ($self, $c, $int) = @_; + $c->res->body('an_int (withrole)'); + } + + package MyApp::BaseController; + $INC{'MyApp/BaseController.pm'} = __FILE__; + + use Moose; + use MooseX::MethodAttributes; + use MyApp::Types qw/Int/; + + extends 'Catalyst::Controller'; + + sub from_parent :Local Args(Int) { + my ($self, $c, $id) = @_; + $c->res->body("from_parent $id"); + } + package MyApp::Controller::WithRole; $INC{'MyApp/Controller/WithRole.pm'} = __FILE__; use Moose; use MooseX::MethodAttributes; - extends 'Catalyst::Controller'; + extends 'MyApp::BaseController'; with 'MyApp::Role'; @@ -462,16 +482,6 @@ SKIP: { is $res->content, 'default', "request '/stringy_enum/a'"; } -{ - my $res = request '/autoclean/an_int/1'; - is $res->content, 'an_int (autoclean)'; -} - -{ - my $res = request '/withrole/an_int/1'; - is $res->content, 'an_int (withrole)'; -} - =over | /chain_base/*/*/*/*/*/* | /chain_base (1) @@ -559,4 +569,28 @@ SKIP: { } +{ + my $res = request '/autoclean/an_int/1'; + is $res->content, 'an_int (autoclean)'; +} + +{ + my $res = request '/withrole/an_int_ns/S'; + is $res->content, 'default'; +} + +{ + my $res = request '/withrole/an_int_ns/111'; + is $res->content, 'an_int (withrole)'; +} + +{ + my $res = request '/withrole/an_int/1'; + is $res->content, 'an_int (withrole)'; +} + +{ + my $res = request '/withrole/from_parent/1'; + is $res->content, 'from_parent 1'; +} done_testing;