[Catalyst-commits] r10446 - in Catalyst-Runtime/5.80/trunk/t:
aggregate lib lib/TestAppMatchSingleArg
lib/TestAppMatchSingleArg/Controller
caelum at dev.catalyst.perl.org
caelum at dev.catalyst.perl.org
Sat Jun 6 10:09:38 GMT 2009
Author: caelum
Date: 2009-06-06 10:09:38 +0000 (Sat, 06 Jun 2009)
New Revision: 10446
Added:
Catalyst-Runtime/5.80/trunk/t/aggregate/live_component_controller_action_path_matchsingle.t
Catalyst-Runtime/5.80/trunk/t/lib/TestAppMatchSingleArg.pm
Catalyst-Runtime/5.80/trunk/t/lib/TestAppMatchSingleArg/
Catalyst-Runtime/5.80/trunk/t/lib/TestAppMatchSingleArg/Controller/
Catalyst-Runtime/5.80/trunk/t/lib/TestAppMatchSingleArg/Controller/Root.pm
Log:
test for stackoverflow Path bug
Added: Catalyst-Runtime/5.80/trunk/t/aggregate/live_component_controller_action_path_matchsingle.t
===================================================================
--- Catalyst-Runtime/5.80/trunk/t/aggregate/live_component_controller_action_path_matchsingle.t (rev 0)
+++ Catalyst-Runtime/5.80/trunk/t/aggregate/live_component_controller_action_path_matchsingle.t 2009-06-06 10:09:38 UTC (rev 10446)
@@ -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)');
+ }
+}
Added: Catalyst-Runtime/5.80/trunk/t/lib/TestAppMatchSingleArg/Controller/Root.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/t/lib/TestAppMatchSingleArg/Controller/Root.pm (rev 0)
+++ Catalyst-Runtime/5.80/trunk/t/lib/TestAppMatchSingleArg/Controller/Root.pm 2009-06-06 10:09:38 UTC (rev 10446)
@@ -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;
Added: Catalyst-Runtime/5.80/trunk/t/lib/TestAppMatchSingleArg.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/t/lib/TestAppMatchSingleArg.pm (rev 0)
+++ Catalyst-Runtime/5.80/trunk/t/lib/TestAppMatchSingleArg.pm 2009-06-06 10:09:38 UTC (rev 10446)
@@ -0,0 +1,8 @@
+package TestAppMatchSingleArg;
+use strict;
+use warnings;
+use Catalyst;
+
+__PACKAGE__->setup;
+
+1;
More information about the Catalyst-commits
mailing list