line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test2::Compare::Scalar; |
2
|
169
|
|
|
169
|
|
1186
|
use strict; |
|
169
|
|
|
|
|
357
|
|
|
169
|
|
|
|
|
5220
|
|
3
|
169
|
|
|
169
|
|
984
|
use warnings; |
|
169
|
|
|
|
|
374
|
|
|
169
|
|
|
|
|
4329
|
|
4
|
|
|
|
|
|
|
|
5
|
169
|
|
|
169
|
|
873
|
use base 'Test2::Compare::Base'; |
|
169
|
|
|
|
|
415
|
|
|
169
|
|
|
|
|
17872
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.000156'; |
8
|
|
|
|
|
|
|
|
9
|
169
|
|
|
169
|
|
1226
|
use Test2::Util::HashBase qw/item/; |
|
169
|
|
|
|
|
397
|
|
|
169
|
|
|
|
|
1081
|
|
10
|
|
|
|
|
|
|
|
11
|
169
|
|
|
169
|
|
21492
|
use Carp qw/croak confess/; |
|
169
|
|
|
|
|
351
|
|
|
169
|
|
|
|
|
22533
|
|
12
|
169
|
|
|
169
|
|
12182
|
use Scalar::Util qw/reftype blessed/; |
|
169
|
|
|
|
|
784
|
|
|
169
|
|
|
|
|
52625
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub init { |
15
|
15
|
|
|
15
|
0
|
312
|
my $self = shift; |
16
|
|
|
|
|
|
|
croak "'item' is a required attribute" |
17
|
15
|
100
|
|
|
|
271
|
unless defined $self->{+ITEM}; |
18
|
|
|
|
|
|
|
|
19
|
14
|
|
|
|
|
43
|
$self->SUPER::init(); |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
1
|
|
|
1
|
1
|
11
|
sub name { '' } |
23
|
1
|
|
|
1
|
1
|
4
|
sub operator { '${...}' } |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub verify { |
26
|
10
|
|
|
10
|
1
|
22
|
my $self = shift; |
27
|
10
|
|
|
|
|
35
|
my %params = @_; |
28
|
10
|
|
|
|
|
26
|
my ($got, $exists) = @params{qw/got exists/}; |
29
|
|
|
|
|
|
|
|
30
|
10
|
100
|
|
|
|
30
|
return 0 unless $exists; |
31
|
9
|
100
|
|
|
|
26
|
return 0 unless defined $got; |
32
|
8
|
100
|
|
|
|
29
|
return 0 unless ref($got); |
33
|
7
|
100
|
100
|
|
|
74
|
return 0 unless reftype($got) eq 'SCALAR' || reftype($got) eq 'VSTRING'; |
34
|
6
|
|
|
|
|
25
|
return 1; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub deltas { |
38
|
7
|
|
|
7
|
1
|
15
|
my $self = shift; |
39
|
7
|
|
|
|
|
21
|
my %params = @_; |
40
|
7
|
|
|
|
|
21
|
my ($got, $convert, $seen) = @params{qw/got convert seen/}; |
41
|
|
|
|
|
|
|
|
42
|
7
|
|
|
|
|
12
|
my $item = $self->{+ITEM}; |
43
|
7
|
|
|
|
|
18
|
my $check = $convert->($item); |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
return ( |
46
|
7
|
|
|
|
|
55
|
$check->run( |
47
|
|
|
|
|
|
|
id => ['SCALAR' => '$*'], |
48
|
|
|
|
|
|
|
got => $$got, |
49
|
|
|
|
|
|
|
convert => $convert, |
50
|
|
|
|
|
|
|
seen => $seen, |
51
|
|
|
|
|
|
|
exists => 1, |
52
|
|
|
|
|
|
|
), |
53
|
|
|
|
|
|
|
); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
1; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
__END__ |