Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 66 lines (61 sloc) 1.778 kB
80eae7b @stash Coverage for the feersum script and Feersum::Runner
authored
1 #!perl
2 use strict;
3 use Test::More;
4 use blib;
5 use lib 't'; use Utils;
6 BEGIN {
7 plan skip_all => "Need Plack >= 0.9950 to run this test"
8 unless eval 'require Plack; $Plack::VERSION >= 0.995';
9 plan skip_all => "Need Test::TCP 1.06 to run this test"
10 unless eval 'require Test::TCP; $Test::TCP::VERSION >= 1.06';
11 }
12
13 plan tests => 7;
14 use Test::TCP;
15
16 test_tcp(
17 client => sub {
18 my $port = shift;
19 my $cv = AE::cv;
20 $cv->begin;
21 my $cli = simple_client GET => '/',
22 port => $port,
23 name => 'feersum runner',
24 sub {
25 my ($body,$headers) = @_;
26 is $headers->{Status}, 200, "script http success";
45b61c7 @stash Fix tests after eg script update
authored
27 like $body, qr/^Hello customer number 0x[0-9a-f]+$/;
80eae7b @stash Coverage for the feersum script and Feersum::Runner
authored
28 $cv->end;
29 };
30 $cv->recv;
31 },
32 server => sub {
33 my $port = shift;
34 exec "$^X -Mblib blib/script/feersum --listen localhost:$port ".
35 "eg/app.psgi";
36 },
37 );
38
39 # XXX: ugh, what's a better cross-platform way of doing this?
40 my $plackup = `which plackup`;
41 chomp $plackup;
42 ok $plackup, 'found plackup';
43
44 test_tcp(
45 client => sub {
46 my $port = shift;
47 my $cv = AE::cv;
48 $cv->begin;
49 my $cli = simple_client GET => '/',
50 port => $port,
51 name => 'plackup runner',
52 sub {
53 my ($body,$headers) = @_;
54 is $headers->{Status}, 200, "script http success";
45b61c7 @stash Fix tests after eg script update
authored
55 like $body, qr/^Hello customer number 0x[0-9a-f]+$/;
80eae7b @stash Coverage for the feersum script and Feersum::Runner
authored
56 $cv->end;
57 };
58 $cv->recv;
59 },
60 server => sub {
61 my $port = shift;
62 exec "$^X -Mblib $plackup -E deployment ".
63 "-s Feersum --listen localhost:$port eg/app.psgi";
64 },
65 );
Something went wrong with that request. Please try again.