X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fcgibin.t;h=6e710076efe4e3a5f22b2ee54a2da074a412bb89;hb=63096ad1c517b045868c94943f7fdb93c25ffadf;hp=52fa7fc71ce377917353c862400f762031c3a116;hpb=21a20b7e40ead509ca832db9099a4b76d3d61cd4;p=catagits%2FCatalyst-Controller-WrapCGI.git diff --git a/t/cgibin.t b/t/cgibin.t index 52fa7fc..6e71007 100644 --- a/t/cgibin.t +++ b/t/cgibin.t @@ -6,18 +6,34 @@ use warnings; use FindBin '$Bin'; use lib "$Bin/lib"; -use Test::More tests => 4; +use Test::More tests => 7; use Catalyst::Test 'TestCGIBin'; use HTTP::Request::Common; -my $response = request POST '/cgi-bin/test.pl', [ +# this should be ignored +$ENV{MOD_PERL} = "mod_perl/2.0"; + +my $response = request POST '/my-bin/path/test.pl', [ foo => 'bar', bar => 'baz' ]; is($response->content, 'foo:bar bar:baz', 'POST to Perl CGI File'); +$response = request POST '/my-bin/exit.pl', [ + name => 'world', +]; + +is($response->content, 'hello world', 'POST to Perl CGI with exit()'); + +$response = request POST '/my-bin/exit.pl', [ + name => 'world', + exit => 17, +]; + +is($response->code, 500, 'POST to Perl CGI with nonzero exit()'); + $response = request POST '/cgihandler/dongs', [ foo => 'bar', bar => 'baz' @@ -34,9 +50,13 @@ $response = request POST '/cgihandler/mtfnpy', [ is($response->content, 'foo:bar bar:baz', 'POST to Perl CGI File through a forward via cgi_action'); +$response = request '/my-bin/path/testdata.pl'; +is($response->content, "testing\n", + 'scripts with __DATA__ sections work'); + SKIP: { skip "Can't run shell scripts on non-*nix", 1 if $^O eq 'MSWin32' || $^O eq 'VMS'; - is(get('/cgi-bin/test.sh'), "Hello!\n", 'Non-Perl CGI File'); + is(get('/my-bin/test.sh'), "Hello!\n", 'Non-Perl CGI File'); }