line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test2::Compare::Custom; |
2
|
169
|
|
|
169
|
|
1235
|
use strict; |
|
169
|
|
|
|
|
336
|
|
|
169
|
|
|
|
|
5135
|
|
3
|
169
|
|
|
169
|
|
847
|
use warnings; |
|
169
|
|
|
|
|
324
|
|
|
169
|
|
|
|
|
4445
|
|
4
|
|
|
|
|
|
|
|
5
|
169
|
|
|
169
|
|
837
|
use base 'Test2::Compare::Base'; |
|
169
|
|
|
|
|
327
|
|
|
169
|
|
|
|
|
19328
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.000155'; |
8
|
|
|
|
|
|
|
|
9
|
169
|
|
|
169
|
|
1161
|
use Test2::Util::HashBase qw/code name operator stringify_got/; |
|
169
|
|
|
|
|
379
|
|
|
169
|
|
|
|
|
1122
|
|
10
|
|
|
|
|
|
|
|
11
|
169
|
|
|
169
|
|
46289
|
use Carp qw/croak/; |
|
169
|
|
|
|
|
457
|
|
|
169
|
|
|
|
|
42852
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub init { |
14
|
262
|
|
|
262
|
0
|
5155
|
my $self = shift; |
15
|
|
|
|
|
|
|
|
16
|
262
|
100
|
|
|
|
1692
|
croak "'code' is required" unless $self->{+CODE}; |
17
|
|
|
|
|
|
|
|
18
|
261
|
|
100
|
|
|
705
|
$self->{+OPERATOR} ||= 'CODE(...)'; |
19
|
261
|
|
100
|
|
|
907
|
$self->{+NAME} ||= ''; |
20
|
|
|
|
|
|
|
$self->{+STRINGIFY_GOT} = $self->SUPER::stringify_got() |
21
|
261
|
100
|
|
|
|
1636
|
unless defined $self->{+STRINGIFY_GOT}; |
22
|
|
|
|
|
|
|
|
23
|
261
|
|
|
|
|
974
|
$self->SUPER::init(); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub verify { |
27
|
264
|
|
|
264
|
1
|
818
|
my $self = shift; |
28
|
264
|
|
|
|
|
892
|
my %params = @_; |
29
|
264
|
|
|
|
|
939
|
my ($got, $exists) = @params{qw/got exists/}; |
30
|
|
|
|
|
|
|
|
31
|
264
|
|
|
|
|
717
|
my $code = $self->{+CODE}; |
32
|
|
|
|
|
|
|
|
33
|
264
|
|
|
|
|
533
|
local $_ = $got; |
34
|
|
|
|
|
|
|
my $ok = $code->( |
35
|
|
|
|
|
|
|
got => $got, |
36
|
|
|
|
|
|
|
exists => $exists, |
37
|
|
|
|
|
|
|
operator => $self->{+OPERATOR}, |
38
|
264
|
|
|
|
|
952
|
name => $self->{+NAME}, |
39
|
|
|
|
|
|
|
); |
40
|
|
|
|
|
|
|
|
41
|
264
|
|
|
|
|
903
|
return $ok; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
1; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
__END__ |