File: dead_recursive_chained_attributes.t

package info (click to toggle)
libcatalyst-perl 5.90132-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,016 kB
  • sloc: perl: 11,061; makefile: 7
file content (41 lines) | stat: -rw-r--r-- 1,048 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
use strict;
use warnings;
use lib 't/lib';

use Test::More tests => 6;

use Catalyst::Test 'TestApp';

eval q{
    package TestApp::Controller::Action::Chained;
    sub should_fail : Chained('should_fail') Args(0) {}
};
ok(!$@);

eval { TestApp->setup_actions; };
like($@, qr|Actions cannot chain to themselves registering /action/chained/should_fail|,
    'Local self referencing attributes makes action setup fail');

eval q{
    package TestApp::Controller::Action::Chained;
    no warnings 'redefine';
    sub should_fail {}
    use warnings 'redefine';
    sub should_also_fail : Chained('/action/chained/should_also_fail') Args(0) {}
};
ok(!$@);

eval { TestApp->setup_actions };
like($@, qr|Actions cannot chain to themselves registering /action/chained/should_also_fail|,
    'Full path self referencing attributes makes action setup fail');

eval q{
    package TestApp::Controller::Action::Chained;
    no warnings 'redefine';
    sub should_also_fail {}
};
ok(!$@);

eval { TestApp->setup_actions };
ok(!$@, 'And ok again') or warn $@;