line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#line 1 |
2
|
4
|
|
|
4
|
|
1541
|
package Plack::Test; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
113
|
|
3
|
4
|
|
|
4
|
|
15
|
use strict; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
72
|
|
4
|
4
|
|
|
4
|
|
14
|
use warnings; |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
178
|
|
5
|
4
|
|
|
4
|
|
14
|
use Carp; |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
16
|
|
6
|
|
|
|
|
|
|
use parent qw(Exporter); |
7
|
|
|
|
|
|
|
our @EXPORT = qw(test_psgi); |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $Impl; |
10
|
|
|
|
|
|
|
$Impl ||= $ENV{PLACK_TEST_IMPL} || "MockHTTP"; |
11
|
|
|
|
|
|
|
|
12
|
10
|
|
|
10
|
1
|
18
|
sub create { |
13
|
|
|
|
|
|
|
my($class, $app, @args) = @_; |
14
|
10
|
|
|
|
|
25
|
|
15
|
10
|
|
|
|
|
549
|
my $subclass = "Plack::Test::$Impl"; |
16
|
10
|
50
|
|
|
|
35448
|
eval "require $subclass"; |
17
|
|
|
|
|
|
|
die $@ if $@; |
18
|
4
|
|
|
4
|
|
522
|
|
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
731
|
|
19
|
10
|
50
|
|
|
|
12
|
no strict 'refs'; |
|
10
|
|
|
|
|
65
|
|
20
|
0
|
|
|
|
|
0
|
if (defined &{"Plack::Test::$Impl\::test_psgi"}) { |
|
0
|
|
|
|
|
0
|
|
21
|
|
|
|
|
|
|
return \&{"Plack::Test::$Impl\::test_psgi"}; |
22
|
|
|
|
|
|
|
} |
23
|
10
|
|
|
|
|
51
|
|
24
|
|
|
|
|
|
|
$subclass->new($app, @args); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
10
|
50
|
33
|
10
|
1
|
172
|
sub test_psgi { |
28
|
0
|
|
|
|
|
0
|
if (ref $_[0] && @_ == 2) { |
29
|
|
|
|
|
|
|
@_ = (app => $_[0], client => $_[1]); |
30
|
10
|
|
|
|
|
28
|
} |
31
|
|
|
|
|
|
|
my %args = @_; |
32
|
10
|
|
|
|
|
24
|
|
33
|
10
|
50
|
|
|
|
30
|
my $app = delete $args{app}; # Backward compat: some implementations don't need app |
34
|
|
|
|
|
|
|
my $client = delete $args{client} or Carp::croak "client test code needed"; |
35
|
10
|
|
|
|
|
48
|
|
36
|
10
|
50
|
|
|
|
73
|
my $tester = Plack::Test->create($app, %args); |
37
|
|
|
|
|
|
|
return $tester->(@_) if ref $tester eq 'CODE'; # compatibility |
38
|
10
|
|
|
10
|
|
48
|
|
|
10
|
|
|
|
|
24826
|
|
39
|
|
|
|
|
|
|
$client->(sub { $tester->request(@_) }); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
1; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
__END__ |