line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package JSON::RPC::Test; |
2
|
1
|
|
|
1
|
|
1110
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
32
|
|
3
|
1
|
|
|
1
|
|
4
|
use parent qw(Exporter); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
6
|
|
4
|
|
|
|
|
|
|
our @EXPORT = qw(test_rpc); |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub test_rpc { |
7
|
1
|
50
|
33
|
1
|
0
|
332
|
if (ref $_[0] && @_ == 2) { |
8
|
1
|
|
|
|
|
4
|
@_ = (dispatch => $_[0], client => $_[1]); |
9
|
|
|
|
|
|
|
} |
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
|
|
3
|
my %args = @_; |
12
|
1
|
|
|
|
|
2
|
my $dispatch = delete $args{dispatch}; |
13
|
|
|
|
|
|
|
$args{app} = sub { |
14
|
17
|
|
|
17
|
|
52971
|
$dispatch->handle_psgi(@_); |
15
|
1
|
|
|
|
|
4
|
}; |
16
|
|
|
|
|
|
|
|
17
|
1
|
|
|
|
|
5
|
@_ = %args; |
18
|
1
|
|
|
|
|
4
|
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 |