From: Rafael Kitover Date: Sat, 6 Jun 2009 10:09:38 +0000 (+0000) Subject: test for stackoverflow Path bug X-Git-Tag: 5.80005~5 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=9dac01c784a1f27fe7bb110442d006f9919e9dc1 test for stackoverflow Path bug --- diff --git a/t/aggregate/live_component_controller_action_path_matchsingle.t b/t/aggregate/live_component_controller_action_path_matchsingle.t new file mode 100644 index 0000000..6370e01 --- /dev/null +++ b/t/aggregate/live_component_controller_action_path_matchsingle.t @@ -0,0 +1,31 @@ +#!perl + +use strict; +use warnings; + +use FindBin; +use lib "$FindBin::Bin/../lib"; + +our $iters; + +BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; } + +use Test::More tests => 2*$iters; +use Catalyst::Test 'TestAppMatchSingleArg'; + +if ( $ENV{CAT_BENCHMARK} ) { + require Benchmark; + Benchmark::timethis( $iters, \&run_tests ); +} +else { + for ( 1 .. $iters ) { + run_tests(); + } +} + +sub run_tests { + { + is(get('/foo/bar'), 'Path', 'multiple args matched :Path'); + is(get('/foo'), 'Path Args(1)', 'single arg matched :Path Args(1)'); + } +} diff --git a/t/lib/TestAppMatchSingleArg.pm b/t/lib/TestAppMatchSingleArg.pm new file mode 100644 index 0000000..8f87993 --- /dev/null +++ b/t/lib/TestAppMatchSingleArg.pm @@ -0,0 +1,8 @@ +package TestAppMatchSingleArg; +use strict; +use warnings; +use Catalyst; + +__PACKAGE__->setup; + +1; diff --git a/t/lib/TestAppMatchSingleArg/Controller/Root.pm b/t/lib/TestAppMatchSingleArg/Controller/Root.pm new file mode 100644 index 0000000..ab24f12 --- /dev/null +++ b/t/lib/TestAppMatchSingleArg/Controller/Root.pm @@ -0,0 +1,19 @@ +package TestAppMatchSingleArg::Controller::Root; + +use strict; +use warnings; +use base 'Catalyst::Controller'; + +__PACKAGE__->config->{namespace} = ''; + +sub match_single : Path Args(1) { + my ($self, $c) = @_; + $c->res->body('Path Args(1)'); +} + +sub match_other : Path { + my ($self, $c) = @_; + $c->res->body('Path'); +} + +1;