Enable hooking parameters into req/res construction. Useful if you are dynamically...
[catagits/Catalyst-Runtime.git] / t / dead_load_bad_args.t
CommitLineData
dd97c1ac 1#!perl
2
3use strict;
4use warnings;
5use lib 't/lib';
6
7use Test::More;
8
9plan tests => 16;
10
11use Catalyst::Test 'TestApp';
12
13for my $fail (
14 "(' ')",
15 "('')",
16 "('1.23')",
17) {
18
19 eval <<"END";
20 package TestApp::Controller::Action::Chained;
21 no warnings 'redefine';
22 sub should_fail : Chained('/') Args$fail {}
23END
24 ok(!$@);
25
26 eval { TestApp->setup_actions };
27 like($@, qr/Invalid Args\Q$fail\E/,
28 "Bad Args$fail attribute makes action setup fail");
29}
30
31for my $ok (
32 "()",
33 "(0)",
34 "(1)",
35 "('0')",
36 "",
37) {
38 eval <<"END";
39 package TestApp::Controller::Action::Chained;
40 no warnings 'redefine';
41 sub should_fail : Chained('/') Args$ok {}
42END
43 ok(!$@);
44 eval { TestApp->setup_actions };
45 ok(!$@, "Args$ok works");
46}