Commit | Line | Data |
356e7503 |
1 | use warnings; |
2 | use strict; |
3 | use Test::More; |
4 | use HTTP::Request::Common; |
5 | |
6 | # In DEBUG mode, we get not a number warnigs |
7 | |
8 | my $error; |
9 | |
10 | { |
11 | package MyApp::Controller::Root; |
12 | $INC{'MyApp/Controller/Root.pm'} = __FILE__; |
13 | |
14 | use base 'Catalyst::Controller'; |
15 | |
16 | sub root :Chained(/) PathPrefix CaptureArgs(0) { } |
17 | |
18 | sub test :Chained(root) Args('"Int"') { |
19 | my ($self, $c) = @_; |
20 | $c->response->body("This is the body"); |
21 | } |
22 | |
23 | sub infinity :Chained(root) PathPart('test') Args { |
24 | my ($self, $c) = @_; |
25 | $c->response->body("This is the body"); |
26 | Test::More::is $c->action->normalized_arg_number, ~0; |
27 | } |
28 | |
29 | sub local :Local Args { |
30 | my ($self, $c) = @_; |
31 | $c->response->body("This is the body"); |
32 | Test::More::is $c->action->normalized_arg_number, ~0; |
33 | } |
34 | |
35 | |
36 | package MyApp; |
37 | use Catalyst; |
38 | |
39 | sub debug { 1 } |
40 | |
41 | $SIG{__WARN__} = sub { $error = shift }; |
42 | |
43 | MyApp->setup; |
44 | } |
45 | |
46 | use Catalyst::Test 'MyApp'; |
47 | |
48 | request GET '/root/test/a/b/c'; |
49 | request GET '/root/local/a/b/c'; |
50 | |
51 | if($error) { |
52 | unlike($error, qr[Argument ""Int"" isn't numeric in repeat]); |
53 | } else { |
54 | ok 1; |
55 | } |
56 | |
57 | done_testing(3); |