X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=t%2Foptional_threads.t;h=b0a05c9becf7cefaeebc06aedde7257ba8c7a4e4;hp=05b4c965b828a550970f5745f3e250997f3abf51;hb=fcfe92b170baa438adf1ff92057ac007781d02b4;hpb=c7ded7aaf69e506924a5406349fd665c7717acb8 diff --git a/t/optional_threads.t b/t/optional_threads.t index 05b4c96..b0a05c9 100644 --- a/t/optional_threads.t +++ b/t/optional_threads.t @@ -1,20 +1,19 @@ -#!perl - use strict; use warnings; +use Test::More; +BEGIN { + plan skip_all => 'set TEST_THREADS to enable this test' + unless $ENV{TEST_THREADS}; +} + use FindBin; use lib "$FindBin::Bin/lib"; - -use Test::More; use Catalyst::Test 'TestApp'; use Catalyst::Request; use Config; use HTTP::Response; -plan skip_all => 'set TEST_THREADS to enable this test' - unless $ENV{TEST_THREADS}; - if ( $Config{useithreads} && !$ENV{CATALYST_SERVER} ) { require threads; plan tests => 3; @@ -27,12 +26,12 @@ else { plan skip_all => 'Needs a Perl with ithreads enabled'; } } - + no warnings 'redefine'; sub request { - my $thr = threads->new( + my $thr = threads->new( sub { Catalyst::Test::local_request('TestApp',@_) }, - @_ + @_ ); $thr->join; } @@ -43,11 +42,11 @@ sub request { TestApp::Controller::Action::Default->begin TestApp::Controller::Action::Default->default TestApp::View::Dump::Request->process - TestApp->end + TestApp::Controller::Root->end ]; my $expected = join( ", ", @expected ); - + ok( my $response = request('http://localhost/action/default'), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' );