PageRenderTime 21ms CodeModel.GetById 11ms app.highlight 8ms RepoModel.GetById 1ms app.codeStats 0ms

/t/020_interface/server_simple-print_banner.t

http://github.com/http-engine/HTTP-Engine
Unknown | 33 lines | 32 code | 1 blank | 0 comment | 0 complexity | 703ce62be0215351b697b5741fcd9341 MD5 | raw file
 1use strict;
 2use warnings;
 3use t::Utils;
 4use Test::More;
 5eval "use HTTP::Server::Simple";
 6plan skip_all => 'this test requires HTTP::Server::Simple' if $@;
 7plan tests => 2;
 8use HTTP::Engine;
 9use Test::TCP;
10
11my $host = '127.0.0.1';
12test_tcp(
13    client => sub {
14    },
15    server => sub {
16        my $port = shift;
17        HTTP::Engine->new(
18            interface => {
19                module => 'ServerSimple',
20                args => {
21                    host => $host,
22                    port => $port,
23                    print_banner => sub {
24                        my $server = shift;
25                        is($server->host, $host, 'server host');
26                        is($server->port, $port, 'server port');
27                    },
28                },
29                request_handler => sub {},
30            },
31        )->run;
32    },
33);