File: 500-example-hello-word.t

package info (click to toggle)
libweb-machine-perl 0.17-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 940 kB
  • sloc: perl: 5,481; makefile: 2
file content (30 lines) | stat: -rw-r--r-- 791 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
30
#!/usr/bin/perl

use strict;
use warnings;
use FindBin;

use Test::More;
use Test::Fatal;

use Plack::Test;
use Plack::Util;

use HTTP::Request::Common;

test_psgi
    Plack::Util::load_psgi( "$FindBin::Bin/../examples/hello-world/app.psgi" ),
    sub {
        my $cb  = shift;
        my $res = $cb->(GET "/");
        is($res->code, 200, '... got the expected status');
        is($res->header('Content-Type'), 'text/html', '... got the expected Content-Type header');
        is($res->header('Content-Length'), 94, '... got the expected Content-Length header');
        is(
            $res->content,
            '<html><head><title>Hello World Resource</title></head><body><h1>Hello World</h1></body></html>',
            '... got the expected content'
        );
    };

done_testing;