File: bad_warnings.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 (71 lines) | stat: -rw-r--r-- 1,553 bytes parent folder | download | duplicates (4)
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
use warnings;
use strict;
use Test::More;
use HTTP::Request::Common;

# In DEBUG mode, we get not a number warnigs

my $error;

{
  package MyApp::Controller::Root;
  $INC{'MyApp/Controller/Root.pm'} = __FILE__;

  use base 'Catalyst::Controller';

  sub root :Chained(/) PathPrefix CaptureArgs(0) { }

  sub test :Chained(root) Args('"Int"') {
    my ($self, $c) = @_;
    $c->response->body("This is the body");
  }

  sub infinity :Chained(root) PathPart('test') Args {
    my ($self, $c) = @_;
    $c->response->body("This is the body");
    Test::More::is $c->action->comparable_arg_number, ~0;
  }

  sub midpoint :Chained(root) PathPart('') CaptureArgs('"Int"') {
    my ($self, $c) = @_;
    Test::More::is $c->action->number_of_captures, 1;
    #Test::More::is $c->action->number_of_captures_constraints, 1;
  }

  sub endpoint :Chained('midpoint') Args('"Int"') {
    my ($self, $c) = @_;
    Test::More::is $c->action->comparable_arg_number, 1;
    Test::More::is $c->action->normalized_arg_number, 1;
  }

  sub local :Local Args {
    my ($self, $c) = @_;
    $c->response->body("This is the body");
    Test::More::is $c->action->comparable_arg_number, ~0;
  }


  package MyApp;
  use Catalyst;

  sub debug { 1 }

  $SIG{__WARN__} = sub { $error = shift };

  MyApp->setup('-Log=fatal');
}

use Catalyst::Test 'MyApp';

request GET '/root/test/a/b/c';
request GET '/root/local/a/b/c';
request GET '/root/11/endpoint/22';


if($error) {
  unlike($error, qr[Argument ""Int"" isn't numeric in repeat]);
} else {
  ok 1;
}

done_testing(6);