X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Flive%2Fcomponent%2Fcontroller%2Faction%2Findex.t;h=6be00f0c42a38fe02f2119f0adb65d52f2734d7d;hb=2ec03726337ab41e0feb274eab238d7883055e3f;hp=a18871bf8dd6b8a063b85c4f768b3a06ce6039b9;hpb=bf60b99492003c9b94a96f7630d725ed6edb65ba;p=catagits%2FCatalyst-Runtime.git diff --git a/t/live/component/controller/action/index.t b/t/live/component/controller/action/index.t index a18871b..6be00f0 100644 --- a/t/live/component/controller/action/index.t +++ b/t/live/component/controller/action/index.t @@ -6,10 +6,24 @@ use warnings; use FindBin; use lib "$FindBin::Bin/../../../lib"; -use Test::More tests => 19; +our $iters; + +BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 2; } + +use Test::More tests => 19*$iters; use Catalyst::Test 'TestApp'; - -for ( 1 .. 1 ) { + +if ( $ENV{CAT_BENCHMARK} ) { + require Benchmark; + Benchmark::timethis( $iters, \&run_tests ); +} +else { + for ( 1 .. $iters ) { + run_tests(); + } +} + +sub run_tests { # test root index { ok( my $response = request('http://localhost/'), 'root index' ); @@ -50,12 +64,12 @@ for ( 1 .. 1 ) { ok( my $response = request('http://localhost/action/index/'), 'second-level controller index' ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); - is( $response->content, 'Action::Index index', 'second-level controller index ok' ); + is( $response->content, 'Action-Index index', 'second-level controller index ok' ); ok( $response = request('http://localhost/action/index'), 'second-level controller index no slash' ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); - is( $response->content, 'Action::Index index', 'second-level controller index no slash ok' ); + is( $response->content, 'Action-Index index', 'second-level controller index no slash ok' ); } # test controller default when index is present