File: 05_lint.t

package info (click to toggle)
libcgi-emulate-psgi-perl 0.23-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 148 kB
  • sloc: perl: 138; makefile: 2
file content (29 lines) | stat: -rw-r--r-- 578 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
use strict;
use Test::More;
use Test::Requires qw( Plack::Test HTTP::Request Plack::Middleware::Lint );
use Test::Requires {
    'Plack' => 0.9981,
};
use CGI::Emulate::PSGI;

my $output = <<CGI;
Status: 302
Content-Type: text/html
X-Foo: bar
Location: http://localhost/
Multiline: Foo
  bar baz

This is the body!
CGI

my $app = CGI::Emulate::PSGI->handler(sub { print $output });
$app = Plack::Middleware::Lint->wrap($app);

Plack::Test::test_psgi($app, sub {
    my $cb = shift;
    my $res = $cb->(HTTP::Request->new(GET => "/"));
    is $res->code, 302;
});

done_testing;