line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test2::Compare::Custom; |
2
|
168
|
|
|
168
|
|
1089
|
use strict; |
|
168
|
|
|
|
|
343
|
|
|
168
|
|
|
|
|
4623
|
|
3
|
168
|
|
|
168
|
|
777
|
use warnings; |
|
168
|
|
|
|
|
303
|
|
|
168
|
|
|
|
|
4088
|
|
4
|
|
|
|
|
|
|
|
5
|
168
|
|
|
168
|
|
807
|
use base 'Test2::Compare::Base'; |
|
168
|
|
|
|
|
297
|
|
|
168
|
|
|
|
|
17625
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.000153'; |
8
|
|
|
|
|
|
|
|
9
|
168
|
|
|
168
|
|
1058
|
use Test2::Util::HashBase qw/code name operator stringify_got/; |
|
168
|
|
|
|
|
457
|
|
|
168
|
|
|
|
|
996
|
|
10
|
|
|
|
|
|
|
|
11
|
168
|
|
|
168
|
|
43077
|
use Carp qw/croak/; |
|
168
|
|
|
|
|
341
|
|
|
168
|
|
|
|
|
38988
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub init { |
14
|
256
|
|
|
256
|
0
|
5321
|
my $self = shift; |
15
|
|
|
|
|
|
|
|
16
|
256
|
100
|
|
|
|
1048
|
croak "'code' is required" unless $self->{+CODE}; |
17
|
|
|
|
|
|
|
|
18
|
255
|
|
100
|
|
|
675
|
$self->{+OPERATOR} ||= 'CODE(...)'; |
19
|
255
|
|
100
|
|
|
632
|
$self->{+NAME} ||= ''; |
20
|
|
|
|
|
|
|
$self->{+STRINGIFY_GOT} = $self->SUPER::stringify_got() |
21
|
255
|
100
|
|
|
|
1574
|
unless defined $self->{+STRINGIFY_GOT}; |
22
|
|
|
|
|
|
|
|
23
|
255
|
|
|
|
|
840
|
$self->SUPER::init(); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub verify { |
27
|
260
|
|
|
260
|
1
|
625
|
my $self = shift; |
28
|
260
|
|
|
|
|
826
|
my %params = @_; |
29
|
260
|
|
|
|
|
918
|
my ($got, $exists) = @params{qw/got exists/}; |
30
|
|
|
|
|
|
|
|
31
|
260
|
|
|
|
|
690
|
my $code = $self->{+CODE}; |
32
|
|
|
|
|
|
|
|
33
|
260
|
|
|
|
|
451
|
local $_ = $got; |
34
|
|
|
|
|
|
|
my $ok = $code->( |
35
|
|
|
|
|
|
|
got => $got, |
36
|
|
|
|
|
|
|
exists => $exists, |
37
|
|
|
|
|
|
|
operator => $self->{+OPERATOR}, |
38
|
260
|
|
|
|
|
1293
|
name => $self->{+NAME}, |
39
|
|
|
|
|
|
|
); |
40
|
|
|
|
|
|
|
|
41
|
260
|
|
|
|
|
1069
|
return $ok; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
1; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
__END__ |