line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package JSON::RPC::Test; |
2
|
1
|
|
|
1
|
|
2162
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
39
|
|
3
|
1
|
|
|
1
|
|
7
|
use parent qw(Exporter); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
9
|
|
4
|
|
|
|
|
|
|
our @EXPORT = qw(test_rpc); |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub test_rpc { |
7
|
1
|
50
|
33
|
1
|
0
|
499
|
if (ref $_[0] && @_ == 2) { |
8
|
1
|
|
|
|
|
6
|
@_ = (dispatch => $_[0], client => $_[1]); |
9
|
|
|
|
|
|
|
} |
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
|
|
6
|
my %args = @_; |
12
|
1
|
|
|
|
|
3
|
my $dispatch = delete $args{dispatch}; |
13
|
|
|
|
|
|
|
$args{app} = sub { |
14
|
16
|
|
|
16
|
|
542179
|
$dispatch->handle_psgi(@_); |
15
|
1
|
|
|
|
|
7
|
}; |
16
|
|
|
|
|
|
|
|
17
|
1
|
|
|
|
|
6
|
@_ = %args; |
18
|
1
|
|
|
|
|
9
|
goto \&Plack::Test::test_psgi; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
1; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 NAME |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
JSON::RPC::Test - Simple Wrapper To Test Your JSON::RPC |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 SYNOPSIS |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
use JSON::RPC::Test; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
test_rpc $dispatch, sub { |
32
|
|
|
|
|
|
|
... |
33
|
|
|
|
|
|
|
}; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
# or |
36
|
|
|
|
|
|
|
test_rpc |
37
|
|
|
|
|
|
|
dispatch => $dispatch, |
38
|
|
|
|
|
|
|
client => sub { |
39
|
|
|
|
|
|
|
... |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=cut |