line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Mocha::MethodCall; |
2
|
|
|
|
|
|
|
# ABSTRACT: Objects to represent method calls |
3
|
|
|
|
|
|
|
$Test::Mocha::MethodCall::VERSION = '0.61'; |
4
|
21
|
|
|
21
|
|
72
|
use strict; |
|
21
|
|
|
|
|
21
|
|
|
21
|
|
|
|
|
544
|
|
5
|
21
|
|
|
21
|
|
73
|
use warnings; |
|
21
|
|
|
|
|
22
|
|
|
21
|
|
|
|
|
425
|
|
6
|
21
|
|
|
21
|
|
77
|
use parent qw( Test::Mocha::Method ); |
|
21
|
|
|
|
|
21
|
|
|
21
|
|
|
|
|
71
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub new { |
9
|
|
|
|
|
|
|
# uncoverable pod |
10
|
541
|
|
|
541
|
0
|
1512
|
my ( $class, %args ) = @_; |
11
|
|
|
|
|
|
|
# caller should be an arrayref tuple [file, line] |
12
|
|
|
|
|
|
|
### assert: defined $args{invocant} |
13
|
|
|
|
|
|
|
### assert: defined $args{caller} |
14
|
|
|
|
|
|
|
### assert: ref $args{caller} eq 'ARRAY' && @{$args{caller}} == 2 |
15
|
541
|
|
|
|
|
2028
|
return $class->SUPER::new(%args); |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub invocant { |
19
|
|
|
|
|
|
|
# uncoverable pod |
20
|
532
|
|
|
532
|
0
|
1008
|
return $_[0]->{invocant}; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub caller { ## no critic (ProhibitBuiltinHomonyms) |
24
|
|
|
|
|
|
|
# uncoverable pod |
25
|
121
|
|
|
121
|
0
|
91
|
return @{ $_[0]->{caller} }; # ($file, $line) |
|
121
|
|
|
|
|
697
|
|
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub stringify_long { |
29
|
|
|
|
|
|
|
# uncoverable pod |
30
|
118
|
|
|
118
|
0
|
3268
|
my ($self) = @_; |
31
|
118
|
|
|
|
|
278
|
return sprintf '%s called at %s line %d', |
32
|
|
|
|
|
|
|
$self->SUPER::stringify, $self->caller; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
1; |