line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test2::Compare::Regex; |
2
|
169
|
|
|
169
|
|
1297
|
use strict; |
|
169
|
|
|
|
|
339
|
|
|
169
|
|
|
|
|
5217
|
|
3
|
169
|
|
|
169
|
|
901
|
use warnings; |
|
169
|
|
|
|
|
320
|
|
|
169
|
|
|
|
|
4300
|
|
4
|
|
|
|
|
|
|
|
5
|
169
|
|
|
169
|
|
878
|
use base 'Test2::Compare::Base'; |
|
169
|
|
|
|
|
342
|
|
|
169
|
|
|
|
|
18064
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.000156'; |
8
|
|
|
|
|
|
|
|
9
|
169
|
|
|
169
|
|
1195
|
use Test2::Util::HashBase qw/input/; |
|
169
|
|
|
|
|
368
|
|
|
169
|
|
|
|
|
1246
|
|
10
|
|
|
|
|
|
|
|
11
|
169
|
|
|
169
|
|
22276
|
use Test2::Util::Ref qw/render_ref rtype/; |
|
169
|
|
|
|
|
370
|
|
|
169
|
|
|
|
|
8981
|
|
12
|
169
|
|
|
169
|
|
1153
|
use Carp qw/croak/; |
|
169
|
|
|
|
|
423
|
|
|
169
|
|
|
|
|
54856
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub init { |
15
|
7
|
|
|
7
|
0
|
231
|
my $self = shift; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
croak "'input' is a required attribute" |
18
|
7
|
100
|
|
|
|
220
|
unless $self->{+INPUT}; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
croak "'input' must be a regex , got '" . $self->{+INPUT} . "'" |
21
|
6
|
100
|
|
|
|
24
|
unless rtype($self->{+INPUT}) eq 'REGEXP'; |
22
|
|
|
|
|
|
|
|
23
|
5
|
|
|
|
|
39
|
$self->SUPER::init(); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
2
|
|
|
2
|
0
|
7
|
sub stringify_got { 1 } |
27
|
|
|
|
|
|
|
|
28
|
3
|
|
|
3
|
1
|
11
|
sub operator { 'eq' } |
29
|
|
|
|
|
|
|
|
30
|
3
|
|
|
3
|
1
|
30
|
sub name { "" . $_[0]->{+INPUT} } |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub verify { |
33
|
11
|
|
|
11
|
1
|
41
|
my $self = shift; |
34
|
11
|
|
|
|
|
33
|
my %params = @_; |
35
|
11
|
|
|
|
|
33
|
my ($got, $exists) = @params{qw/got exists/}; |
36
|
|
|
|
|
|
|
|
37
|
11
|
100
|
|
|
|
32
|
return 0 unless $exists; |
38
|
|
|
|
|
|
|
|
39
|
10
|
|
|
|
|
22
|
my $in = $self->{+INPUT}; |
40
|
10
|
100
|
|
|
|
30
|
my $got_type = rtype($got) or return 0; |
41
|
|
|
|
|
|
|
|
42
|
8
|
100
|
|
|
|
28
|
return 0 unless $got_type eq 'REGEXP'; |
43
|
|
|
|
|
|
|
|
44
|
7
|
|
|
|
|
46
|
return "$in" eq "$got"; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
1; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
__END__ |