Merge branch 'check_return_of_write_to_psgi_input' of https://github.com/billmoseley...
[catagits/Catalyst-Runtime.git] / t / args0_bug.t
1 use warnings;
2 use strict;
3 use Test::More;
4
5 {
6   package MyApp::Controller::Root;
7   $INC{'MyApp/Controller/Root.pm'} = __FILE__;
8
9   use Moose;
10   use MooseX::MethodAttributes;
11
12   extends 'Catalyst::Controller';
13
14   sub chain_base :Chained(/) CaptureArgs(1) { }
15
16     sub chained_one_args_0  : Chained(chain_base) PathPart('') Args(1) { $_[1]->res->body('chained_one_args_0') }
17     sub chained_one_args_1  : Chained(chain_base) PathPart('') Args(1) { $_[1]->res->body('chained_one_args_1') }
18     sub chained_one_args_2  : Chained(chain_base) PathPart('') Args(1) { $_[1]->res->body('chained_one_args_2') }
19
20     sub chained_zero_args_0 : Chained(chain_base) PathPart('') Args(0) { $_[1]->res->body('chained_zero_args_0') }
21     sub chained_zero_args_1 : Chained(chain_base) PathPart('') Args(0) { $_[1]->res->body('chained_zero_args_1') }
22     sub chained_zero_args_2 : Chained(chain_base) PathPart('') Args(0) { $_[1]->res->body('chained_zero_args_2') }
23
24   MyApp::Controller::Root->config(namespace=>'');
25
26   package MyApp;
27   use Catalyst;
28
29   #MyApp->config(use_chained_args_0_special_case=>1);
30   MyApp->setup;
31 }
32
33 =over
34
35 [debug] Loaded Chained actions:
36 .-----------------------------------------+---------------------------------------------------.
37 | Path Spec                               | Private                                           |
38 +-----------------------------------------+---------------------------------------------------+
39 | /chain_base/*/*                         | /chain_base (1)                                   |
40 |                                         | => /chained_one_args_0 (1)                        |
41 | /chain_base/*/*                         | /chain_base (1)                                   |
42 |                                         | => /chained_one_args_1 (1)                        |
43 | /chain_base/*                           | /chain_base (1)                                   |
44 |                                         | => /chained_zero_args_0 (0)                       |
45 | /chain_base/*                           | /chain_base (1)                                   |
46 |                                         | => /chained_zero_args_1 (0)                       |
47 '-----------------------------------------+---------------------------------------------------'
48
49 =cut
50
51 use Catalyst::Test 'MyApp';
52 {
53    my $res = request '/chain_base/capturearg/arg';
54   is $res->content, 'chained_one_args_2', "request '/chain_base/capturearg/arg'";
55 }
56
57 {
58     my $res = request '/chain_base/capturearg';
59     is $res->content, 'chained_zero_args_2', "request '/chain_base/capturearg'";
60 }
61
62 done_testing;
63
64 __END__
65