X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fdead_load_bad_args.t;fp=t%2Fdead_load_bad_args.t;h=67fe64b8d75c3226ecb1859a900c0dbba47ddf3f;hb=4a41d5d1ec3187cc41e15767b21c14b2aee31740;hp=0000000000000000000000000000000000000000;hpb=2757db2c7c600c8a0b8e2b4366f38c97804c2844;p=catagits%2FCatalyst-Runtime.git diff --git a/t/dead_load_bad_args.t b/t/dead_load_bad_args.t new file mode 100644 index 0000000..67fe64b --- /dev/null +++ b/t/dead_load_bad_args.t @@ -0,0 +1,46 @@ +#!perl + +use strict; +use warnings; +use lib 't/lib'; + +use Test::More; + +plan tests => 16; + +use Catalyst::Test 'TestApp'; + +for my $fail ( + "(' ')", + "('')", + "('1.23')", +) { + + eval <<"END"; + package TestApp::Controller::Action::Chained; + no warnings 'redefine'; + sub should_fail : Chained('/') Args$fail {} +END + ok(!$@); + + eval { TestApp->setup_actions }; + like($@, qr/Invalid Args\Q$fail\E/, + "Bad Args$fail attribute makes action setup fail"); +} + +for my $ok ( + "()", + "(0)", + "(1)", + "('0')", + "", +) { + eval <<"END"; + package TestApp::Controller::Action::Chained; + no warnings 'redefine'; + sub should_fail : Chained('/') Args$ok {} +END + ok(!$@); + eval { TestApp->setup_actions }; + ok(!$@, "Args$ok works"); +}