| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Plack::Test; |
|
2
|
74
|
|
|
74
|
|
3306898
|
use strict; |
|
|
74
|
|
|
|
|
113
|
|
|
|
74
|
|
|
|
|
2356
|
|
|
3
|
74
|
|
|
74
|
|
473
|
use warnings; |
|
|
74
|
|
|
|
|
108
|
|
|
|
74
|
|
|
|
|
3162
|
|
|
4
|
74
|
|
|
74
|
|
323
|
use Carp; |
|
|
74
|
|
|
|
|
96
|
|
|
|
74
|
|
|
|
|
4566
|
|
|
5
|
74
|
|
|
74
|
|
16316
|
use parent qw(Exporter); |
|
|
74
|
|
|
|
|
11104
|
|
|
|
74
|
|
|
|
|
369
|
|
|
6
|
|
|
|
|
|
|
our @EXPORT = qw(test_psgi); |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $Impl; |
|
9
|
|
|
|
|
|
|
$Impl ||= $ENV{PLACK_TEST_IMPL} || "MockHTTP"; |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub create { |
|
12
|
129
|
|
|
129
|
1
|
185520
|
my($class, $app, @args) = @_; |
|
13
|
|
|
|
|
|
|
|
|
14
|
129
|
|
|
|
|
271
|
my $subclass = "Plack::Test::$Impl"; |
|
15
|
129
|
|
|
|
|
7424
|
eval "require $subclass"; |
|
16
|
129
|
50
|
|
|
|
617
|
die $@ if $@; |
|
17
|
|
|
|
|
|
|
|
|
18
|
74
|
|
|
74
|
|
9916
|
no strict 'refs'; |
|
|
74
|
|
|
|
|
141
|
|
|
|
74
|
|
|
|
|
19228
|
|
|
19
|
129
|
50
|
|
|
|
228
|
if (defined &{"Plack::Test::$Impl\::test_psgi"}) { |
|
|
129
|
|
|
|
|
838
|
|
|
20
|
0
|
|
|
|
|
0
|
return \&{"Plack::Test::$Impl\::test_psgi"}; |
|
|
0
|
|
|
|
|
0
|
|
|
21
|
|
|
|
|
|
|
} |
|
22
|
|
|
|
|
|
|
|
|
23
|
129
|
|
|
|
|
692
|
$subclass->new($app, @args); |
|
24
|
|
|
|
|
|
|
} |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub test_psgi { |
|
27
|
128
|
100
|
66
|
128
|
1
|
4439873
|
if (ref $_[0] && @_ == 2) { |
|
28
|
89
|
|
|
|
|
382
|
@_ = (app => $_[0], client => $_[1]); |
|
29
|
|
|
|
|
|
|
} |
|
30
|
128
|
|
|
|
|
485
|
my %args = @_; |
|
31
|
|
|
|
|
|
|
|
|
32
|
128
|
|
|
|
|
282
|
my $app = delete $args{app}; # Backward compat: some implementations don't need app |
|
33
|
128
|
50
|
|
|
|
394
|
my $client = delete $args{client} or Carp::croak "client test code needed"; |
|
34
|
|
|
|
|
|
|
|
|
35
|
128
|
|
|
|
|
748
|
my $tester = Plack::Test->create($app, %args); |
|
36
|
128
|
50
|
|
|
|
681
|
return $tester->(@_) if ref $tester eq 'CODE'; # compatibility |
|
37
|
|
|
|
|
|
|
|
|
38
|
128
|
|
|
301
|
|
1190
|
$client->(sub { $tester->request(@_) }); |
|
|
301
|
|
|
|
|
730243
|
|
|
39
|
|
|
|
|
|
|
} |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
1; |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
__END__ |