Commit | Line | Data |
13c6b4cc |
1 | #!perl |
2 | |
3 | use strict; |
4 | use warnings; |
5 | use lib 't/lib'; |
6 | |
7 | use Test::More tests => 6; |
8 | |
9 | use Catalyst::Test 'TestApp'; |
10 | |
11 | eval q{ |
12 | package TestApp::Controller::Action::Chained; |
13 | sub should_fail : Chained('should_fail') Args(0) {} |
14 | }; |
15 | ok(!$@); |
16 | |
17 | eval { TestApp->setup_actions; }; |
18 | like($@, qr|Actions cannot chain to themselves registering /action/chained/should_fail|, |
19 | 'Local self referencing attributes makes action setup fail'); |
20 | |
21 | eval q{ |
22 | package TestApp::Controller::Action::Chained; |
23 | no warnings 'redefine'; |
24 | sub should_fail {} |
25 | use warnings 'redefine'; |
26 | sub should_also_fail : Chained('/action/chained/should_also_fail') Args(0) {} |
27 | }; |
28 | ok(!$@); |
29 | |
30 | eval { TestApp->setup_actions }; |
31 | like($@, qr|Actions cannot chain to themselves registering /action/chained/should_also_fail|, |
32 | 'Full path self referencing attributes makes action setup fail'); |
33 | |
34 | eval q{ |
35 | package TestApp::Controller::Action::Chained; |
36 | no warnings 'redefine'; |
37 | sub should_also_fail {} |
38 | }; |
39 | ok(!$@); |
40 | |
41 | eval { TestApp->setup_actions }; |
42 | ok(!$@, 'And ok again') or warn $@; |
43 | |