line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
$Test::Spy::Method::VERSION = '0.003'; |
2
|
|
|
|
|
|
|
use v5.10; |
3
|
6
|
|
|
6
|
|
75
|
use strict; |
|
6
|
|
|
|
|
24
|
|
4
|
6
|
|
|
6
|
|
30
|
use warnings; |
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
183
|
|
5
|
6
|
|
|
6
|
|
29
|
|
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
143
|
|
6
|
|
|
|
|
|
|
use Moo; |
7
|
6
|
|
|
6
|
|
26
|
use Mooish::AttributeBuilder; |
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
29
|
|
8
|
6
|
|
|
6
|
|
2162
|
use Carp qw(croak); |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
369
|
|
9
|
6
|
|
|
6
|
|
39
|
|
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
2778
|
|
10
|
|
|
|
|
|
|
has field '_throws' => ( |
11
|
|
|
|
|
|
|
writer => 1, |
12
|
|
|
|
|
|
|
clearer => 1, |
13
|
|
|
|
|
|
|
); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
has field '_calls' => ( |
16
|
|
|
|
|
|
|
writer => 1, |
17
|
|
|
|
|
|
|
clearer => 1, |
18
|
|
|
|
|
|
|
); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
has field '_returns' => ( |
21
|
|
|
|
|
|
|
writer => 1, |
22
|
|
|
|
|
|
|
clearer => 1, |
23
|
|
|
|
|
|
|
); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
has field '_returns_list' => ( |
26
|
|
|
|
|
|
|
writer => 1, |
27
|
|
|
|
|
|
|
clearer => 1, |
28
|
|
|
|
|
|
|
); |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
extends 'Test::Spy::Observer'; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
{ |
33
|
|
|
|
|
|
|
my ($self) = @_; |
34
|
|
|
|
|
|
|
|
35
|
9
|
|
|
9
|
|
23
|
$self->_clear_returns; |
36
|
|
|
|
|
|
|
$self->_clear_returns_list; |
37
|
9
|
|
|
|
|
180
|
$self->_clear_calls; |
38
|
9
|
|
|
|
|
185
|
$self->_clear_throws; |
39
|
9
|
|
|
|
|
201
|
|
40
|
9
|
|
|
|
|
202
|
return; |
41
|
|
|
|
|
|
|
} |
42
|
9
|
|
|
|
|
97
|
|
43
|
|
|
|
|
|
|
{ |
44
|
|
|
|
|
|
|
my ($self, @values) = @_; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
$self->_forget; |
47
|
7
|
|
|
7
|
1
|
26
|
|
48
|
|
|
|
|
|
|
if (@values == 1) { |
49
|
7
|
|
|
|
|
20
|
$self->_set_returns($values[0]); |
50
|
|
|
|
|
|
|
} |
51
|
7
|
100
|
|
|
|
24
|
else { |
52
|
5
|
|
|
|
|
27
|
$self->_set_returns_list([@values]); |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
2
|
|
|
|
|
12
|
return $self->clear; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
7
|
|
|
|
|
33
|
{ |
59
|
|
|
|
|
|
|
my ($self, $sub) = @_; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
croak 'should_call expects a coderef' |
62
|
|
|
|
|
|
|
unless ref $sub eq 'CODE'; |
63
|
1
|
|
|
1
|
1
|
4
|
|
64
|
|
|
|
|
|
|
$self->_forget; |
65
|
1
|
50
|
|
|
|
5
|
|
66
|
|
|
|
|
|
|
$self->_set_calls($sub); |
67
|
|
|
|
|
|
|
|
68
|
1
|
|
|
|
|
3
|
return $self->clear; |
69
|
|
|
|
|
|
|
} |
70
|
1
|
|
|
|
|
8
|
|
71
|
|
|
|
|
|
|
{ |
72
|
1
|
|
|
|
|
4
|
my ($self, $exception) = @_; |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
$self->_forget; |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
$self->_set_throws($exception); |
77
|
1
|
|
|
1
|
1
|
3
|
|
78
|
|
|
|
|
|
|
return $self->clear; |
79
|
1
|
|
|
|
|
3
|
} |
80
|
|
|
|
|
|
|
|
81
|
1
|
|
|
|
|
6
|
{ |
82
|
|
|
|
|
|
|
my ($self, $inner_self, @params) = @_; |
83
|
1
|
|
|
|
|
4
|
|
84
|
|
|
|
|
|
|
$self->SUPER::_called($inner_self, @params); |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
die $self->_throws |
87
|
|
|
|
|
|
|
if defined $self->_throws; |
88
|
35
|
|
|
35
|
|
75
|
|
89
|
|
|
|
|
|
|
return $self->_calls->($inner_self, @params) |
90
|
35
|
|
|
|
|
124
|
if $self->_calls; |
91
|
|
|
|
|
|
|
|
92
|
35
|
100
|
|
|
|
216
|
return @{$self->_returns_list} |
93
|
|
|
|
|
|
|
if $self->_returns_list; |
94
|
|
|
|
|
|
|
|
95
|
34
|
100
|
|
|
|
99
|
return $self->_returns; |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
33
|
100
|
|
|
|
88
|
1; |
|
2
|
|
|
|
|
19
|
|
99
|
|
|
|
|
|
|
|