line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test2::Compare::Custom; |
2
|
169
|
|
|
169
|
|
1179
|
use strict; |
|
169
|
|
|
|
|
340
|
|
|
169
|
|
|
|
|
5255
|
|
3
|
169
|
|
|
169
|
|
881
|
use warnings; |
|
169
|
|
|
|
|
354
|
|
|
169
|
|
|
|
|
4367
|
|
4
|
|
|
|
|
|
|
|
5
|
169
|
|
|
169
|
|
848
|
use base 'Test2::Compare::Base'; |
|
169
|
|
|
|
|
288
|
|
|
169
|
|
|
|
|
19343
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.000156'; |
8
|
|
|
|
|
|
|
|
9
|
169
|
|
|
169
|
|
1122
|
use Test2::Util::HashBase qw/code name operator stringify_got/; |
|
169
|
|
|
|
|
355
|
|
|
169
|
|
|
|
|
1125
|
|
10
|
|
|
|
|
|
|
|
11
|
169
|
|
|
169
|
|
40059
|
use Carp qw/croak/; |
|
169
|
|
|
|
|
346
|
|
|
169
|
|
|
|
|
46106
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub init { |
14
|
262
|
|
|
262
|
0
|
5899
|
my $self = shift; |
15
|
|
|
|
|
|
|
|
16
|
262
|
100
|
|
|
|
1343
|
croak "'code' is required" unless $self->{+CODE}; |
17
|
|
|
|
|
|
|
|
18
|
261
|
|
100
|
|
|
778
|
$self->{+OPERATOR} ||= 'CODE(...)'; |
19
|
261
|
|
100
|
|
|
761
|
$self->{+NAME} ||= ''; |
20
|
|
|
|
|
|
|
$self->{+STRINGIFY_GOT} = $self->SUPER::stringify_got() |
21
|
261
|
100
|
|
|
|
1920
|
unless defined $self->{+STRINGIFY_GOT}; |
22
|
|
|
|
|
|
|
|
23
|
261
|
|
|
|
|
1063
|
$self->SUPER::init(); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub verify { |
27
|
264
|
|
|
264
|
1
|
918
|
my $self = shift; |
28
|
264
|
|
|
|
|
929
|
my %params = @_; |
29
|
264
|
|
|
|
|
966
|
my ($got, $exists) = @params{qw/got exists/}; |
30
|
|
|
|
|
|
|
|
31
|
264
|
|
|
|
|
535
|
my $code = $self->{+CODE}; |
32
|
|
|
|
|
|
|
|
33
|
264
|
|
|
|
|
549
|
local $_ = $got; |
34
|
|
|
|
|
|
|
my $ok = $code->( |
35
|
|
|
|
|
|
|
got => $got, |
36
|
|
|
|
|
|
|
exists => $exists, |
37
|
|
|
|
|
|
|
operator => $self->{+OPERATOR}, |
38
|
264
|
|
|
|
|
1299
|
name => $self->{+NAME}, |
39
|
|
|
|
|
|
|
); |
40
|
|
|
|
|
|
|
|
41
|
264
|
|
|
|
|
958
|
return $ok; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
1; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
__END__ |