line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
$Test::Spy::Method::VERSION = '0.004'; |
2
|
|
|
|
|
|
|
use v5.10; |
3
|
6
|
|
|
6
|
|
87
|
use strict; |
|
6
|
|
|
|
|
27
|
|
4
|
6
|
|
|
6
|
|
32
|
use warnings; |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
128
|
|
5
|
6
|
|
|
6
|
|
28
|
|
|
6
|
|
|
|
|
10
|
|
|
6
|
|
|
|
|
176
|
|
6
|
|
|
|
|
|
|
use Moo; |
7
|
6
|
|
|
6
|
|
32
|
use Mooish::AttributeBuilder -standard; |
|
6
|
|
|
|
|
16
|
|
|
6
|
|
|
|
|
45
|
|
8
|
6
|
|
|
6
|
|
2046
|
use Carp qw(croak); |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
40
|
|
9
|
6
|
|
|
6
|
|
625
|
|
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
2606
|
|
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
|
|
17
|
$self->_clear_returns; |
36
|
|
|
|
|
|
|
$self->_clear_returns_list; |
37
|
9
|
|
|
|
|
169
|
$self->_clear_calls; |
38
|
9
|
|
|
|
|
188
|
$self->_clear_throws; |
39
|
9
|
|
|
|
|
196
|
|
40
|
9
|
|
|
|
|
180
|
return; |
41
|
|
|
|
|
|
|
} |
42
|
9
|
|
|
|
|
50
|
|
43
|
|
|
|
|
|
|
{ |
44
|
|
|
|
|
|
|
my ($self, @values) = @_; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
$self->_forget; |
47
|
7
|
|
|
7
|
1
|
22
|
|
48
|
|
|
|
|
|
|
if (@values == 1) { |
49
|
7
|
|
|
|
|
19
|
$self->_set_returns($values[0]); |
50
|
|
|
|
|
|
|
} |
51
|
7
|
100
|
|
|
|
29
|
else { |
52
|
5
|
|
|
|
|
25
|
$self->_set_returns_list([@values]); |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
2
|
|
|
|
|
8
|
return $self->clear; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
7
|
|
|
|
|
46
|
{ |
59
|
|
|
|
|
|
|
my ($self, $sub) = @_; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
croak 'should_call expects a coderef' |
62
|
|
|
|
|
|
|
unless ref $sub eq 'CODE'; |
63
|
1
|
|
|
1
|
1
|
6
|
|
64
|
|
|
|
|
|
|
$self->_forget; |
65
|
1
|
50
|
|
|
|
5
|
|
66
|
|
|
|
|
|
|
$self->_set_calls($sub); |
67
|
|
|
|
|
|
|
|
68
|
1
|
|
|
|
|
14
|
return $self->clear; |
69
|
|
|
|
|
|
|
} |
70
|
1
|
|
|
|
|
4
|
|
71
|
|
|
|
|
|
|
{ |
72
|
1
|
|
|
|
|
10
|
my ($self, $exception) = @_; |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
$self->_forget; |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
$self->_set_throws($exception); |
77
|
1
|
|
|
1
|
1
|
6
|
|
78
|
|
|
|
|
|
|
return $self->clear; |
79
|
1
|
|
|
|
|
6
|
} |
80
|
|
|
|
|
|
|
|
81
|
1
|
|
|
|
|
6
|
{ |
82
|
|
|
|
|
|
|
my ($self, $inner_self, @params) = @_; |
83
|
1
|
|
|
|
|
3
|
|
84
|
|
|
|
|
|
|
$self->SUPER::_called($inner_self, @params); |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
die $self->_throws |
87
|
|
|
|
|
|
|
if defined $self->_throws; |
88
|
35
|
|
|
35
|
|
88
|
|
89
|
|
|
|
|
|
|
return $self->_calls->($inner_self, @params) |
90
|
35
|
|
|
|
|
115
|
if $self->_calls; |
91
|
|
|
|
|
|
|
|
92
|
35
|
100
|
|
|
|
218
|
return @{$self->_returns_list} |
93
|
|
|
|
|
|
|
if $self->_returns_list; |
94
|
|
|
|
|
|
|
|
95
|
34
|
100
|
|
|
|
89
|
return $self->_returns; |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
33
|
100
|
|
|
|
99
|
1; |
|
2
|
|
|
|
|
19
|
|
99
|
|
|
|
|
|
|
|