added cgi.pl helper script
[catagits/Catalyst-Runtime.git] / t / 13beginend.t
CommitLineData
fc7ec1d9 1package TestApp;
2
3use Catalyst;
4
5__PACKAGE__->action(
6
7 '!begin' => sub {
8 my ( $self, $c ) = @_;
9 $c->res->output('foo');
10 },
11
12 '!default' => sub { },
13
14 '!end' => sub {
15 my ( $self, $c ) = @_;
16 $c->res->output( $c->res->output . 'bar' );
17 },
18
19);
20
21package TestApp::C::Foo::Bar;
22
23TestApp->action(
24
25 '!?begin' => sub {
26 my ( $self, $c ) = @_;
27 $c->res->output('yada');
28 },
29
30 '!?default' => sub { },
31
32 '!?end' => sub {
33 my ( $self, $c ) = @_;
34 $c->res->output('yada');
35 $c->res->output( $c->res->output . 'yada' );
36 },
37
38);
39
40package main;
41
42use Test::More tests => 2;
43use Catalyst::Test 'TestApp';
44
45ok( get('/foo') =~ /foobar/ );
46ok( get('/foo_bar/foo') =~ /yadayada/ );