line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::EasyMock::MockObject; |
2
|
9
|
|
|
9
|
|
46
|
use strict; |
|
9
|
|
|
|
|
17
|
|
|
9
|
|
|
|
|
285
|
|
3
|
9
|
|
|
9
|
|
42
|
use warnings; |
|
9
|
|
|
|
|
17
|
|
|
9
|
|
|
|
|
2169
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 NAME |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
Test::EasyMock::MockObject - Mock object. |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=cut |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 METHOD |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head2 isa($module) |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
Mock to I method. |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=cut |
18
|
|
|
|
|
|
|
# Override |
19
|
|
|
|
|
|
|
sub isa { |
20
|
|
|
|
|
|
|
# TODO: expect 時の引数に eq や not(eq(...)) を使えるようになり次第 |
21
|
|
|
|
|
|
|
# and_stub_return として定義する |
22
|
6
|
|
|
6
|
1
|
21
|
my ($self, $module) = @_; |
23
|
6
|
50
|
|
|
|
20
|
return unless $module; |
24
|
|
|
|
|
|
|
|
25
|
6
|
|
|
|
|
22
|
my $self_module = $self->{_control}->{_module}; |
26
|
6
|
100
|
|
|
|
20
|
return unless $self_module; |
27
|
|
|
|
|
|
|
|
28
|
5
|
|
|
|
|
23
|
return $module eq $self_module; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head2 can($method) |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
Mock to I method. |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=cut |
36
|
|
|
|
|
|
|
sub can { |
37
|
5
|
|
|
5
|
1
|
72
|
my $self = shift; |
38
|
5
|
|
|
|
|
20
|
return $self->{_control}->process_method_invocation($self, 'can', @_); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head2 AUTOLOAD |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
Mock to any method. |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=cut |
46
|
|
|
|
|
|
|
sub AUTOLOAD { |
47
|
98
|
|
|
98
|
|
26215
|
our $AUTOLOAD; |
48
|
98
|
|
|
|
|
142
|
my $self = shift; |
49
|
98
|
|
|
|
|
101
|
my ($sub) = do { |
50
|
98
|
|
|
|
|
210
|
local $1; |
51
|
98
|
|
|
|
|
744
|
$AUTOLOAD =~ m{::(\w+)\z}xms; |
52
|
|
|
|
|
|
|
}; |
53
|
98
|
50
|
|
|
|
252
|
return if $sub eq 'DESTROY'; |
54
|
98
|
|
|
|
|
419
|
return $self->{_control}->process_method_invocation($self, $sub, @_); |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
1; |