line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test2::Compare::Regex; |
2
|
169
|
|
|
169
|
|
1202
|
use strict; |
|
169
|
|
|
|
|
369
|
|
|
169
|
|
|
|
|
4820
|
|
3
|
169
|
|
|
169
|
|
840
|
use warnings; |
|
169
|
|
|
|
|
361
|
|
|
169
|
|
|
|
|
4405
|
|
4
|
|
|
|
|
|
|
|
5
|
169
|
|
|
169
|
|
808
|
use base 'Test2::Compare::Base'; |
|
169
|
|
|
|
|
365
|
|
|
169
|
|
|
|
|
19179
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.000155'; |
8
|
|
|
|
|
|
|
|
9
|
169
|
|
|
169
|
|
1196
|
use Test2::Util::HashBase qw/input/; |
|
169
|
|
|
|
|
344
|
|
|
169
|
|
|
|
|
1118
|
|
10
|
|
|
|
|
|
|
|
11
|
169
|
|
|
169
|
|
21792
|
use Test2::Util::Ref qw/render_ref rtype/; |
|
169
|
|
|
|
|
370
|
|
|
169
|
|
|
|
|
8837
|
|
12
|
169
|
|
|
169
|
|
1089
|
use Carp qw/croak/; |
|
169
|
|
|
|
|
358
|
|
|
169
|
|
|
|
|
49542
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub init { |
15
|
7
|
|
|
7
|
0
|
252
|
my $self = shift; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
croak "'input' is a required attribute" |
18
|
7
|
100
|
|
|
|
268
|
unless $self->{+INPUT}; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
croak "'input' must be a regex , got '" . $self->{+INPUT} . "'" |
21
|
6
|
100
|
|
|
|
27
|
unless rtype($self->{+INPUT}) eq 'REGEXP'; |
22
|
|
|
|
|
|
|
|
23
|
5
|
|
|
|
|
38
|
$self->SUPER::init(); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
2
|
|
|
2
|
0
|
8
|
sub stringify_got { 1 } |
27
|
|
|
|
|
|
|
|
28
|
3
|
|
|
3
|
1
|
16
|
sub operator { 'eq' } |
29
|
|
|
|
|
|
|
|
30
|
3
|
|
|
3
|
1
|
26
|
sub name { "" . $_[0]->{+INPUT} } |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub verify { |
33
|
11
|
|
|
11
|
1
|
44
|
my $self = shift; |
34
|
11
|
|
|
|
|
41
|
my %params = @_; |
35
|
11
|
|
|
|
|
46
|
my ($got, $exists) = @params{qw/got exists/}; |
36
|
|
|
|
|
|
|
|
37
|
11
|
100
|
|
|
|
32
|
return 0 unless $exists; |
38
|
|
|
|
|
|
|
|
39
|
10
|
|
|
|
|
24
|
my $in = $self->{+INPUT}; |
40
|
10
|
100
|
|
|
|
30
|
my $got_type = rtype($got) or return 0; |
41
|
|
|
|
|
|
|
|
42
|
8
|
100
|
|
|
|
35
|
return 0 unless $got_type eq 'REGEXP'; |
43
|
|
|
|
|
|
|
|
44
|
7
|
|
|
|
|
59
|
return "$in" eq "$got"; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
1; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
__END__ |