line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
$Test::Spy::Method::VERSION = '0.005'; |
2
|
|
|
|
|
|
|
use v5.10; |
3
|
7
|
|
|
7
|
|
79
|
use strict; |
|
7
|
|
|
|
|
24
|
|
4
|
7
|
|
|
7
|
|
34
|
use warnings; |
|
7
|
|
|
|
|
11
|
|
|
7
|
|
|
|
|
158
|
|
5
|
7
|
|
|
7
|
|
30
|
|
|
7
|
|
|
|
|
11
|
|
|
7
|
|
|
|
|
204
|
|
6
|
|
|
|
|
|
|
use Moo; |
7
|
7
|
|
|
7
|
|
40
|
use Mooish::AttributeBuilder -standard; |
|
7
|
|
|
|
|
11
|
|
|
7
|
|
|
|
|
33
|
|
8
|
7
|
|
|
7
|
|
2192
|
use Carp qw(croak); |
|
7
|
|
|
|
|
16
|
|
|
7
|
|
|
|
|
35
|
|
9
|
7
|
|
|
7
|
|
680
|
|
|
7
|
|
|
|
|
13
|
|
|
7
|
|
|
|
|
3003
|
|
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
|
|
16
|
$self->_clear_returns; |
36
|
|
|
|
|
|
|
$self->_clear_returns_list; |
37
|
9
|
|
|
|
|
156
|
$self->_clear_calls; |
38
|
9
|
|
|
|
|
184
|
$self->_clear_throws; |
39
|
9
|
|
|
|
|
168
|
|
40
|
9
|
|
|
|
|
162
|
return; |
41
|
|
|
|
|
|
|
} |
42
|
9
|
|
|
|
|
40
|
|
43
|
|
|
|
|
|
|
{ |
44
|
|
|
|
|
|
|
my ($self, @values) = @_; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
$self->_forget; |
47
|
7
|
|
|
7
|
1
|
20
|
|
48
|
|
|
|
|
|
|
if (@values == 1) { |
49
|
7
|
|
|
|
|
19
|
$self->_set_returns($values[0]); |
50
|
|
|
|
|
|
|
} |
51
|
7
|
100
|
|
|
|
19
|
else { |
52
|
5
|
|
|
|
|
20
|
$self->_set_returns_list([@values]); |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
2
|
|
|
|
|
7
|
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
|
3
|
|
64
|
|
|
|
|
|
|
$self->_forget; |
65
|
1
|
50
|
|
|
|
5
|
|
66
|
|
|
|
|
|
|
$self->_set_calls($sub); |
67
|
|
|
|
|
|
|
|
68
|
1
|
|
|
|
|
4
|
return $self->clear; |
69
|
|
|
|
|
|
|
} |
70
|
1
|
|
|
|
|
5
|
|
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
|
|
|
|
|
4
|
} |
80
|
|
|
|
|
|
|
|
81
|
1
|
|
|
|
|
4
|
{ |
82
|
|
|
|
|
|
|
my ($self, $inner_self, @params) = @_; |
83
|
1
|
|
|
|
|
5
|
|
84
|
|
|
|
|
|
|
$self->SUPER::_called($inner_self, @params); |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
die $self->_throws |
87
|
|
|
|
|
|
|
if defined $self->_throws; |
88
|
35
|
|
|
35
|
|
65
|
|
89
|
|
|
|
|
|
|
return $self->_calls->($inner_self, @params) |
90
|
35
|
|
|
|
|
115
|
if $self->_calls; |
91
|
|
|
|
|
|
|
|
92
|
35
|
100
|
|
|
|
190
|
return @{$self->_returns_list} |
93
|
|
|
|
|
|
|
if $self->_returns_list; |
94
|
|
|
|
|
|
|
|
95
|
34
|
100
|
|
|
|
71
|
return $self->_returns; |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
33
|
100
|
|
|
|
74
|
1; |
|
2
|
|
|
|
|
13
|
|
99
|
|
|
|
|
|
|
|