since _context is a weak ref it can go out of scope before all the errors are finishe...
[catagits/Catalyst-Runtime.git] / t / args0_bug.t
CommitLineData
6a02419e 1use warnings;
2use strict;
3use 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
6a02419e 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
67b8d829 19 sub chained_zero_args_0 : Chained(chain_base) PathPart('') Args(0) { $_[1]->res->body('chained_zero_args_0') }
20 sub chained_zero_args_1 : Chained(chain_base) PathPart('') Args(0) { $_[1]->res->body('chained_zero_args_1') }
21
6a02419e 22 MyApp::Controller::Root->config(namespace=>'');
23
24 package MyApp;
25 use Catalyst;
26
7a504990 27 #MyApp->config(use_chained_args_0_special_case=>1);
6a02419e 28 MyApp->setup;
29}
30
31=over
32
33[debug] Loaded Chained actions:
34.-----------------------------------------+---------------------------------------------------.
35| Path Spec | Private |
36+-----------------------------------------+---------------------------------------------------+
37| /chain_base/*/* | /chain_base (1) |
38| | => /chained_one_args_0 (1) |
39| /chain_base/*/* | /chain_base (1) |
40| | => /chained_one_args_1 (1) |
41| /chain_base/* | /chain_base (1) |
42| | => /chained_zero_args_0 (0) |
43| /chain_base/* | /chain_base (1) |
44| | => /chained_zero_args_1 (0) |
45'-----------------------------------------+---------------------------------------------------'
46
47=cut
48
49use Catalyst::Test 'MyApp';
6a02419e 50{
67b8d829 51 my $res = request '/chain_base/capturearg/arg';
52 is $res->content, 'chained_one_args_1', "request '/chain_base/capturearg/arg'";
6a02419e 53}
54
55{
6a02419e 56 my $res = request '/chain_base/capturearg';
67b8d829 57 is $res->content, 'chained_zero_args_1', "request '/chain_base/capturearg'";
6a02419e 58}
59
60done_testing;
67b8d829 61
62__END__
63