Commit | Line | Data |
dd97c1ac |
1 | use strict; |
2 | use warnings; |
3 | use lib 't/lib'; |
4 | |
5 | use Test::More; |
6 | |
a82c96cf |
7 | # This test needs to be rewritten (and the code it was using as well) since |
8 | # when we added the arg and capturearg type constraint support, we now allow |
9 | # non integer values. however we could probably support some additional sanity |
10 | # testing on the values, so this is a nice TODO for someone -jnap |
11 | |
12 | plan skip_all => 'Removing this test because constraint arg types allow this'; |
13 | |
dd97c1ac |
14 | use Catalyst::Test 'TestApp'; |
15 | |
16 | for my $fail ( |
17 | "(' ')", |
18 | "('')", |
19 | "('1.23')", |
2782bef2 |
20 | "(-1)", |
dd97c1ac |
21 | ) { |
08f8d85c |
22 | for my $type (qw(Args CaptureArgs)) { |
23 | eval <<"END"; |
24 | package TestApp::Controller::Action::Chained; |
25 | no warnings 'redefine'; |
26 | sub should_fail : Chained('/') ${type}${fail} {} |
dd97c1ac |
27 | END |
08f8d85c |
28 | ok(!$@); |
dd97c1ac |
29 | |
08f8d85c |
30 | eval { TestApp->setup_actions }; |
31 | like($@, qr/Invalid \Q${type}${fail}\E/, |
32 | "Bad ${type}${fail} attribute makes action setup fail"); |
33 | } |
dd97c1ac |
34 | } |
35 | |
36 | for my $ok ( |
37 | "()", |
38 | "(0)", |
39 | "(1)", |
40 | "('0')", |
41 | "", |
42 | ) { |
08f8d85c |
43 | for my $type (qw(Args CaptureArgs)) { |
44 | eval <<"END"; |
45 | package TestApp::Controller::Action::Chained; |
46 | no warnings 'redefine'; |
47 | sub should_fail : Chained('/') ${type}${ok} {} |
48 | END |
49 | ok(!$@); |
50 | eval { TestApp->setup_actions }; |
51 | ok(!$@, "${type}${ok} works"); |
52 | } |
53 | } |
54 | |
55 | for my $first (qw(Args CaptureArgs)) { |
56 | for my $second (qw(Args CaptureArgs)) { |
57 | eval <<"END"; |
58 | package TestApp::Controller::Action::Chained; |
59 | no warnings 'redefine'; |
60 | sub should_fail :Chained('/') $first $second {} |
dd97c1ac |
61 | END |
08f8d85c |
62 | ok(!$@); |
63 | eval { TestApp->setup_actions }; |
64 | my $msg = $first eq $second |
65 | ? "Multiple $first" |
66 | : "Combining Args and CaptureArgs"; |
67 | like($@, qr/$msg attributes not supported registering/, |
68 | "$first + $second attribute makes action setup fail"); |
69 | } |
dd97c1ac |
70 | } |
08f8d85c |
71 | |
72 | done_testing(); |