line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test2::Compare::Scalar; |
2
|
168
|
|
|
168
|
|
1101
|
use strict; |
|
168
|
|
|
|
|
351
|
|
|
168
|
|
|
|
|
4725
|
|
3
|
168
|
|
|
168
|
|
825
|
use warnings; |
|
168
|
|
|
|
|
323
|
|
|
168
|
|
|
|
|
4163
|
|
4
|
|
|
|
|
|
|
|
5
|
168
|
|
|
168
|
|
840
|
use base 'Test2::Compare::Base'; |
|
168
|
|
|
|
|
339
|
|
|
168
|
|
|
|
|
16689
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.000153'; |
8
|
|
|
|
|
|
|
|
9
|
168
|
|
|
168
|
|
1181
|
use Test2::Util::HashBase qw/item/; |
|
168
|
|
|
|
|
319
|
|
|
168
|
|
|
|
|
1095
|
|
10
|
|
|
|
|
|
|
|
11
|
168
|
|
|
168
|
|
21784
|
use Carp qw/croak confess/; |
|
168
|
|
|
|
|
348
|
|
|
168
|
|
|
|
|
20357
|
|
12
|
168
|
|
|
168
|
|
1096
|
use Scalar::Util qw/reftype blessed/; |
|
168
|
|
|
|
|
10050
|
|
|
168
|
|
|
|
|
47939
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub init { |
15
|
15
|
|
|
15
|
0
|
281
|
my $self = shift; |
16
|
|
|
|
|
|
|
croak "'item' is a required attribute" |
17
|
15
|
100
|
|
|
|
255
|
unless defined $self->{+ITEM}; |
18
|
|
|
|
|
|
|
|
19
|
14
|
|
|
|
|
50
|
$self->SUPER::init(); |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
1
|
|
|
1
|
1
|
24
|
sub name { '' } |
23
|
1
|
|
|
1
|
1
|
7
|
sub operator { '${...}' } |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub verify { |
26
|
10
|
|
|
10
|
1
|
18
|
my $self = shift; |
27
|
10
|
|
|
|
|
33
|
my %params = @_; |
28
|
10
|
|
|
|
|
25
|
my ($got, $exists) = @params{qw/got exists/}; |
29
|
|
|
|
|
|
|
|
30
|
10
|
100
|
|
|
|
28
|
return 0 unless $exists; |
31
|
9
|
100
|
|
|
|
22
|
return 0 unless defined $got; |
32
|
8
|
100
|
|
|
|
23
|
return 0 unless ref($got); |
33
|
7
|
100
|
100
|
|
|
51
|
return 0 unless reftype($got) eq 'SCALAR' || reftype($got) eq 'VSTRING'; |
34
|
6
|
|
|
|
|
19
|
return 1; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub deltas { |
38
|
7
|
|
|
7
|
1
|
12
|
my $self = shift; |
39
|
7
|
|
|
|
|
17
|
my %params = @_; |
40
|
7
|
|
|
|
|
19
|
my ($got, $convert, $seen) = @params{qw/got convert seen/}; |
41
|
|
|
|
|
|
|
|
42
|
7
|
|
|
|
|
13
|
my $item = $self->{+ITEM}; |
43
|
7
|
|
|
|
|
17
|
my $check = $convert->($item); |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
return ( |
46
|
7
|
|
|
|
|
63
|
$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__ |