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