Added failing tests for invalid UTF-8
[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");
5dd46e24 26 Test::More::is $c->action->comparable_arg_number, ~0;
27 }
28
29 sub midpoint :Chained(root) PathPart('') CaptureArgs('"Int"') {
30 my ($self, $c) = @_;
31 Test::More::is $c->action->number_of_captures, 1;
32 #Test::More::is $c->action->number_of_captures_constraints, 1;
33 }
34
35 sub endpoint :Chained('midpoint') Args('"Int"') {
36 my ($self, $c) = @_;
37 Test::More::is $c->action->comparable_arg_number, 1;
38 Test::More::is $c->action->normalized_arg_number, 1;
356e7503 39 }
40
41 sub local :Local Args {
42 my ($self, $c) = @_;
43 $c->response->body("This is the body");
5dd46e24 44 Test::More::is $c->action->comparable_arg_number, ~0;
356e7503 45 }
46
47
48 package MyApp;
49 use Catalyst;
50
51 sub debug { 1 }
52
53 $SIG{__WARN__} = sub { $error = shift };
54
55 MyApp->setup;
56}
57
58use Catalyst::Test 'MyApp';
59
60request GET '/root/test/a/b/c';
61request GET '/root/local/a/b/c';
5dd46e24 62request GET '/root/11/endpoint/22';
63
356e7503 64
65if($error) {
66 unlike($error, qr[Argument ""Int"" isn't numeric in repeat]);
67} else {
68 ok 1;
69}
70
5dd46e24 71done_testing(6);