line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test2::Compare::Scalar; |
2
|
169
|
|
|
169
|
|
1626
|
use strict; |
|
169
|
|
|
|
|
363
|
|
|
169
|
|
|
|
|
5161
|
|
3
|
169
|
|
|
169
|
|
901
|
use warnings; |
|
169
|
|
|
|
|
345
|
|
|
169
|
|
|
|
|
4361
|
|
4
|
|
|
|
|
|
|
|
5
|
169
|
|
|
169
|
|
856
|
use base 'Test2::Compare::Base'; |
|
169
|
|
|
|
|
342
|
|
|
169
|
|
|
|
|
18681
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.000155'; |
8
|
|
|
|
|
|
|
|
9
|
169
|
|
|
169
|
|
1303
|
use Test2::Util::HashBase qw/item/; |
|
169
|
|
|
|
|
362
|
|
|
169
|
|
|
|
|
1167
|
|
10
|
|
|
|
|
|
|
|
11
|
169
|
|
|
169
|
|
23122
|
use Carp qw/croak confess/; |
|
169
|
|
|
|
|
382
|
|
|
169
|
|
|
|
|
21786
|
|
12
|
169
|
|
|
169
|
|
1188
|
use Scalar::Util qw/reftype blessed/; |
|
169
|
|
|
|
|
10876
|
|
|
169
|
|
|
|
|
49992
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub init { |
15
|
15
|
|
|
15
|
0
|
291
|
my $self = shift; |
16
|
|
|
|
|
|
|
croak "'item' is a required attribute" |
17
|
15
|
100
|
|
|
|
264
|
unless defined $self->{+ITEM}; |
18
|
|
|
|
|
|
|
|
19
|
14
|
|
|
|
|
42
|
$self->SUPER::init(); |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
1
|
|
|
1
|
1
|
11
|
sub name { '' } |
23
|
1
|
|
|
1
|
1
|
5
|
sub operator { '${...}' } |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub verify { |
26
|
10
|
|
|
10
|
1
|
21
|
my $self = shift; |
27
|
10
|
|
|
|
|
31
|
my %params = @_; |
28
|
10
|
|
|
|
|
36
|
my ($got, $exists) = @params{qw/got exists/}; |
29
|
|
|
|
|
|
|
|
30
|
10
|
100
|
|
|
|
30
|
return 0 unless $exists; |
31
|
9
|
100
|
|
|
|
27
|
return 0 unless defined $got; |
32
|
8
|
100
|
|
|
|
21
|
return 0 unless ref($got); |
33
|
7
|
100
|
100
|
|
|
46
|
return 0 unless reftype($got) eq 'SCALAR' || reftype($got) eq 'VSTRING'; |
34
|
6
|
|
|
|
|
23
|
return 1; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub deltas { |
38
|
7
|
|
|
7
|
1
|
13
|
my $self = shift; |
39
|
7
|
|
|
|
|
21
|
my %params = @_; |
40
|
7
|
|
|
|
|
20
|
my ($got, $convert, $seen) = @params{qw/got convert seen/}; |
41
|
|
|
|
|
|
|
|
42
|
7
|
|
|
|
|
11
|
my $item = $self->{+ITEM}; |
43
|
7
|
|
|
|
|
18
|
my $check = $convert->($item); |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
return ( |
46
|
7
|
|
|
|
|
47
|
$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__ |