X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fcgibin.t;h=ce36f1b7ee4b3d1f59b043ac0993d6e60c0b1b1a;hb=1d40d9c3ce5fb228adaa52cdefecfa76929853c6;hp=140d47a7625a8f9b64309f866315288747d12e1b;hpb=d5ba2ab2046dc314890bc7d3c2f9185f605d9f85;p=catagits%2FCatalyst-Controller-WrapCGI.git diff --git a/t/cgibin.t b/t/cgibin.t index 140d47a..ce36f1b 100644 --- a/t/cgibin.t +++ b/t/cgibin.t @@ -7,12 +7,23 @@ use FindBin '$Bin'; use lib "$Bin/lib"; use Test::More; -use Catalyst::Test 'TestCGIBin'; use HTTP::Request::Common; +my %orig_sig; +BEGIN { + %orig_sig = %SIG; +# perl < 5.8.9 won't set a %SIG entry to undef, it sets it to '' + %orig_sig = map { defined $_ ? $_ : '' } %orig_sig + if $] < 5.008009; +} + +use Catalyst::Test 'TestCGIBin'; + # this should be ignored $ENV{MOD_PERL} = "mod_perl/2.0"; +is_deeply \%SIG, \%orig_sig, '%SIG is preserved on compile'; + my $response = request POST '/my-bin/path/test.pl', [ foo => 'bar', bar => 'baz' @@ -54,8 +65,6 @@ $response = request '/my-bin/pathinfo.pl/path/info'; is($response->content, '/path/info', 'PATH_INFO works'); -my %orig_sig = %SIG; - ok request '/my-bin/sigs.pl'; is_deeply \%SIG, \%orig_sig, '%SIG is preserved'; @@ -66,8 +75,12 @@ SKIP: { # for some reason the +x is not preserved in the dist system "chmod +x $Bin/lib/TestCGIBin/root/cgi-bin/test.sh"; + system "chmod +x $Bin/lib/TestCGIBin/root/cgi-bin/exit_nonzero.sh"; is(get('/my-bin/test.sh'), "Hello!\n", 'Non-Perl CGI File'); + + $response = request GET '/my-bin/exit_nonzero.sh'; + is $response->code, 500, 'Non-Perl CGI with non-zero exit dies'; } done_testing;