use normalized args to silence warnings in DEBUG mode
[catagits/Catalyst-Runtime.git] / t / bad_warnings.t
CommitLineData
356e7503 1use warnings;
2use strict;
3use Test::More;
4use HTTP::Request::Common;
5
6# In DEBUG mode, we get not a number warnigs
7
8my $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
46use Catalyst::Test 'MyApp';
47
48request GET '/root/test/a/b/c';
49request GET '/root/local/a/b/c';
50
51if($error) {
52 unlike($error, qr[Argument ""Int"" isn't numeric in repeat]);
53} else {
54 ok 1;
55}
56
57done_testing(3);