X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=t%2Foptional_stress.t;h=9e73cc5125f7951402442db68110b3b8fa0f7b06;hp=076c4f9255a6ec8fd749b89289789188b165ab39;hb=33d3ae66457093bf400181b1a8145460257fc563;hpb=a2e038a1e9cbc0f1ea32b7087e6b47efe3af082f diff --git a/t/optional_stress.t b/t/optional_stress.t index 076c4f9..9e73cc5 100644 --- a/t/optional_stress.t +++ b/t/optional_stress.t @@ -1,37 +1,38 @@ -#!perl - -use strict; -use warnings; - -use FindBin; -use lib "$FindBin::Bin/lib"; - -use Test::More; -use Catalyst::Test 'TestApp'; -use YAML; - -our ( $iters, $tests ); - -BEGIN { - plan skip_all => 'set TEST_STRESS to enable this test' - unless $ENV{TEST_STRESS}; - - $iters = $ENV{TEST_STRESS} || 10; - $tests = YAML::LoadFile("$FindBin::Bin/optional_stress.yml"); - - my $total_tests = 0; - map { $total_tests += scalar @{ $tests->{$_} } } keys %{$tests}; - plan tests => $iters * $total_tests; -} - -for ( 1 .. $iters ) { - run_tests(); -} - -sub run_tests { - foreach my $test_group ( keys %{$tests} ) { - foreach my $test ( @{ $tests->{$test_group} } ) { - ok( request($test), $test_group . ' - ' . $test ); - } - } -} +use strict; +use warnings; + +use Test::More; +BEGIN { + plan skip_all => 'set TEST_STRESS to enable this test' + unless $ENV{TEST_STRESS}; +} + +use FindBin; +use lib "$FindBin::Bin/lib"; +use Catalyst::Test 'TestApp'; + +our ( $iters, $tests ); + +BEGIN { + eval "use YAML"; + plan skip_all => 'YAML is required for this test' if $@; + + $iters = $ENV{TEST_STRESS} || 10; + $tests = YAML::LoadFile("$FindBin::Bin/optional_stress.yml"); + + my $total_tests = 0; + map { $total_tests += scalar @{ $tests->{$_} } } keys %{$tests}; + plan tests => $iters * $total_tests; +} + +for ( 1 .. $iters ) { + run_tests(); +} + +sub run_tests { + foreach my $test_group ( keys %{$tests} ) { + foreach my $test ( @{ $tests->{$test_group} } ) { + ok( request($test), $test_group . ' - ' . $test ); + } + } +}