From: nperez Date: Thu, 17 Jun 2010 22:51:13 +0000 (-0500) Subject: Add failing test for ENV feature X-Git-Tag: v0.003~4 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FWeb-Simple.git;a=commitdiff_plain;h=298a02dfad348a5cb08ce0ca079b4e22debced42 Add failing test for ENV feature --- diff --git a/t/env.t b/t/env.t new file mode 100644 index 0000000..7a97658 --- /dev/null +++ b/t/env.t @@ -0,0 +1,36 @@ +use strict; +use warnings FATAL => 'all'; + +use Test::More ( + eval { require HTTP::Request::AsCGI } + ? 'no_plan' + : (skip_all => 'No HTTP::Request::AsCGI') +); + +{ + use Web::Simple 'EnvTest'; + package EnvTest; + dispatch { + sub (GET) { + my $env = @_[ENV]; + [ 200, + [ "Content-type" => "text/plain" ], + [ 'foo' ] + ] + }, + } +} + +use HTTP::Request::Common qw(GET POST); + +my $app = EnvTest->new; + +sub run_request { + my $request = shift; + my $c = HTTP::Request::AsCGI->new($request)->setup; + $app->run; + $c->restore; + return $c->response; +} + +run_request(GET 'http://localhost/');