line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test2::Compare::String; |
2
|
169
|
|
|
169
|
|
1148
|
use strict; |
|
169
|
|
|
|
|
341
|
|
|
169
|
|
|
|
|
4887
|
|
3
|
169
|
|
|
169
|
|
856
|
use warnings; |
|
169
|
|
|
|
|
315
|
|
|
169
|
|
|
|
|
5737
|
|
4
|
|
|
|
|
|
|
|
5
|
169
|
|
|
169
|
|
911
|
use Carp qw/confess/; |
|
169
|
|
|
|
|
331
|
|
|
169
|
|
|
|
|
7239
|
|
6
|
|
|
|
|
|
|
|
7
|
169
|
|
|
169
|
|
906
|
use base 'Test2::Compare::Base'; |
|
169
|
|
|
|
|
360
|
|
|
169
|
|
|
|
|
19475
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = '0.000155'; |
10
|
|
|
|
|
|
|
|
11
|
169
|
|
|
169
|
|
1197
|
use Test2::Util::HashBase qw/input/; |
|
169
|
|
|
|
|
406
|
|
|
169
|
|
|
|
|
1432
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# Overloads '!' for us. |
14
|
169
|
|
|
169
|
|
22936
|
use Test2::Compare::Negatable; |
|
169
|
|
|
|
|
342
|
|
|
169
|
|
|
|
|
1279
|
|
15
|
|
|
|
|
|
|
|
16
|
63
|
|
|
63
|
0
|
196
|
sub stringify_got { 1 } |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub init { |
19
|
8688
|
|
|
8688
|
0
|
106393
|
my $self = shift; |
20
|
|
|
|
|
|
|
confess "input must be defined for 'String' check" |
21
|
8688
|
100
|
|
|
|
24925
|
unless defined $self->{+INPUT}; |
22
|
|
|
|
|
|
|
|
23
|
8687
|
|
|
|
|
24308
|
$self->SUPER::init(@_); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub name { |
27
|
89
|
|
|
89
|
1
|
492
|
my $self = shift; |
28
|
89
|
|
|
|
|
193
|
my $in = $self->{+INPUT}; |
29
|
89
|
|
|
|
|
271
|
return "$in"; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub operator { |
33
|
102
|
|
|
102
|
1
|
429
|
my $self = shift; |
34
|
|
|
|
|
|
|
|
35
|
102
|
100
|
|
|
|
269
|
return '' unless @_; |
36
|
79
|
|
|
|
|
156
|
my ($got) = @_; |
37
|
|
|
|
|
|
|
|
38
|
79
|
100
|
|
|
|
182
|
return '' unless defined($got); |
39
|
|
|
|
|
|
|
|
40
|
73
|
100
|
|
|
|
210
|
return 'ne' if $self->{+NEGATE}; |
41
|
70
|
|
|
|
|
232
|
return 'eq'; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub verify { |
45
|
10552
|
|
|
10552
|
1
|
17422
|
my $self = shift; |
46
|
10552
|
|
|
|
|
30709
|
my %params = @_; |
47
|
10552
|
|
|
|
|
23052
|
my ($got, $exists) = @params{qw/got exists/}; |
48
|
|
|
|
|
|
|
|
49
|
10552
|
100
|
|
|
|
20771
|
return 0 unless $exists; |
50
|
10530
|
100
|
|
|
|
21489
|
return 0 unless defined $got; |
51
|
|
|
|
|
|
|
|
52
|
10520
|
|
|
|
|
17455
|
my $input = $self->{+INPUT}; |
53
|
10520
|
|
|
|
|
16037
|
my $negate = $self->{+NEGATE}; |
54
|
|
|
|
|
|
|
|
55
|
10520
|
100
|
|
|
|
19464
|
return "$input" ne "$got" if $negate; |
56
|
10512
|
|
|
|
|
35424
|
return "$input" eq "$got"; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
1; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
__END__ |