File: psgi.t

package info (click to toggle)
libcgi-compile-perl 0.27-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 248 kB
  • sloc: perl: 372; makefile: 2
file content (24 lines) | stat: -rw-r--r-- 561 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use Test::More;
use CGI::Compile;
use CGI;
use Test::Requires qw(CGI::Emulate::PSGI Plack::Test HTTP::Request::Common);

use CGI::Emulate::PSGI;
use Plack::Test;
use HTTP::Request::Common;

my $sub = CGI::Compile->compile("t/hello.cgi");
my $app = CGI::Emulate::PSGI->handler($sub);

test_psgi app => $app, client => sub {
    my $cb = shift;

    my $res = $cb->(GET "http://localhost/?name=foo");
    is $res->content, "Hello foo counter=1";

    $res = $cb->(GET "http://localhost/?name=bar");
    is $res->content, "Hello bar counter=2";
};


done_testing;