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;h=58c2f1180b2f200cf0ff844b374964037ef49369;hp=67fe64b8d75c3226ecb1859a900c0dbba47ddf3f;hb=02336198551ec2d7edfa74911919b8804bfc69c8;hpb=dd97c1ac48f275a692de1d2ce980e9d3155d78b9 diff --git a/t/dead_load_bad_args.t b/t/dead_load_bad_args.t index 67fe64b..58c2f11 100644 --- a/t/dead_load_bad_args.t +++ b/t/dead_load_bad_args.t @@ -1,12 +1,15 @@ -#!perl - use strict; use warnings; use lib 't/lib'; use Test::More; -plan tests => 16; +# This test needs to be rewritten (and the code it was using as well) since +# when we added the arg and capturearg type constraint support, we now allow +# non integer values. however we could probably support some additional sanity +# testing on the values, so this is a nice TODO for someone -jnap + +plan skip_all => 'Removing this test because constraint arg types allow this'; use Catalyst::Test 'TestApp'; @@ -14,18 +17,20 @@ for my $fail ( "(' ')", "('')", "('1.23')", + "(-1)", ) { - - 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 +40,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(!$@, "Args$ok works"); + 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 }; + 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();