The nginx bullshit can just die
[catagits/Catalyst-Runtime.git] / t / dead_load_bad_args.t
1 #!perl
2
3 use strict;
4 use warnings;
5 use lib 't/lib';
6
7 use Test::More;
8
9 plan tests => 16;
10
11 use Catalyst::Test 'TestApp';
12
13 for 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 {}
23 END
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
31 for 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 {}
42 END
43     ok(!$@);
44     eval { TestApp->setup_actions };
45     ok(!$@, "Args$ok works");
46 }