X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=t%2Fdead_load_bad_args.t;fp=t%2Fdead_load_bad_args.t;h=8542a13edf64aa963ddb3722f0824f2101df58d9;hp=67fe64b8d75c3226ecb1859a900c0dbba47ddf3f;hb=08f8d85ca6f74ecf186f0a367bb80dbc4deb63e9;hpb=bc71493a916595310ac3a3b2edd335140dcfe02d diff --git a/t/dead_load_bad_args.t b/t/dead_load_bad_args.t index 67fe64b..8542a13 100644 --- a/t/dead_load_bad_args.t +++ b/t/dead_load_bad_args.t @@ -6,8 +6,6 @@ use lib 't/lib'; use Test::More; -plan tests => 16; - use Catalyst::Test 'TestApp'; for my $fail ( @@ -15,17 +13,18 @@ for my $fail ( "('')", "('1.23')", ) { - - eval <<"END"; - package TestApp::Controller::Action::Chained; - no warnings 'redefine'; - sub should_fail : Chained('/') Args$fail {} + for my $type (qw(Args CaptureArgs)) { + eval <<"END"; + package TestApp::Controller::Action::Chained; + no warnings 'redefine'; + sub should_fail : Chained('/') ${type}${fail} {} END - ok(!$@); + ok(!$@); - eval { TestApp->setup_actions }; - like($@, qr/Invalid Args\Q$fail\E/, - "Bad Args$fail attribute makes action setup fail"); + eval { TestApp->setup_actions }; + like($@, qr/Invalid \Q${type}${fail}\E/, + "Bad ${type}${fail} attribute makes action setup fail"); + } } for my $ok ( @@ -35,12 +34,33 @@ for my $ok ( "('0')", "", ) { - eval <<"END"; - package TestApp::Controller::Action::Chained; - no warnings 'redefine'; - sub should_fail : Chained('/') Args$ok {} + for my $type (qw(Args CaptureArgs)) { + eval <<"END"; + package TestApp::Controller::Action::Chained; + no warnings 'redefine'; + sub should_fail : Chained('/') ${type}${ok} {} +END + ok(!$@); + eval { TestApp->setup_actions }; + ok(!$@, "${type}${ok} works"); + } +} + +for my $first (qw(Args CaptureArgs)) { + for my $second (qw(Args CaptureArgs)) { + eval <<"END"; + package TestApp::Controller::Action::Chained; + no warnings 'redefine'; + sub should_fail :Chained('/') $first $second {} END - ok(!$@); - eval { TestApp->setup_actions }; - ok(!$@, "Args$ok works"); + ok(!$@); + eval { TestApp->setup_actions }; + my $msg = $first eq $second + ? "Multiple $first" + : "Combining Args and CaptureArgs"; + like($@, qr/$msg attributes not supported registering/, + "$first + $second attribute makes action setup fail"); + } } + +done_testing();