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=3d7dd8abf47e1809d6a8033e04704bbf875eb263;hp=9ed878fe6bf307125e31428b835800cd3f99ce31;hb=4e45fa288ea80bf2a4587dd2278c784286aafdc3;hpb=ef70874e6070b1fc54e90f6a271261dfacb5286f diff --git a/t/optional_threads.t b/t/optional_threads.t index 9ed878f..3d7dd8a 100644 --- a/t/optional_threads.t +++ b/t/optional_threads.t @@ -1,5 +1,3 @@ -#!perl - use strict; use warnings; @@ -28,15 +26,16 @@ else { plan skip_all => 'Needs a Perl with ithreads enabled'; } } - + no warnings 'redefine'; -sub request { - my $thr = threads->new( - sub { Catalyst::Test::local_request('TestApp',@_) }, - @_ +my $request_code = \&request; +*request = sub { + my $thr = threads->new( + sub { $request_code->(@_) }, + @_ ); $thr->join; -} +}; # test that running inside a thread works ok { @@ -48,7 +47,7 @@ sub request { ]; 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' );