line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test2::Compare::Regex; |
2
|
168
|
|
|
168
|
|
1146
|
use strict; |
|
168
|
|
|
|
|
337
|
|
|
168
|
|
|
|
|
4661
|
|
3
|
168
|
|
|
168
|
|
796
|
use warnings; |
|
168
|
|
|
|
|
344
|
|
|
168
|
|
|
|
|
3995
|
|
4
|
|
|
|
|
|
|
|
5
|
168
|
|
|
168
|
|
801
|
use base 'Test2::Compare::Base'; |
|
168
|
|
|
|
|
336
|
|
|
168
|
|
|
|
|
18300
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.000153'; |
8
|
|
|
|
|
|
|
|
9
|
168
|
|
|
168
|
|
1153
|
use Test2::Util::HashBase qw/input/; |
|
168
|
|
|
|
|
324
|
|
|
168
|
|
|
|
|
1044
|
|
10
|
|
|
|
|
|
|
|
11
|
168
|
|
|
168
|
|
21233
|
use Test2::Util::Ref qw/render_ref rtype/; |
|
168
|
|
|
|
|
373
|
|
|
168
|
|
|
|
|
9072
|
|
12
|
168
|
|
|
168
|
|
1120
|
use Carp qw/croak/; |
|
168
|
|
|
|
|
365
|
|
|
168
|
|
|
|
|
45960
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub init { |
15
|
7
|
|
|
7
|
0
|
219
|
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
|
|
|
|
23
|
unless rtype($self->{+INPUT}) eq 'REGEXP'; |
22
|
|
|
|
|
|
|
|
23
|
5
|
|
|
|
|
34
|
$self->SUPER::init(); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
2
|
|
|
2
|
0
|
5
|
sub stringify_got { 1 } |
27
|
|
|
|
|
|
|
|
28
|
3
|
|
|
3
|
1
|
9
|
sub operator { 'eq' } |
29
|
|
|
|
|
|
|
|
30
|
3
|
|
|
3
|
1
|
22
|
sub name { "" . $_[0]->{+INPUT} } |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub verify { |
33
|
11
|
|
|
11
|
1
|
39
|
my $self = shift; |
34
|
11
|
|
|
|
|
35
|
my %params = @_; |
35
|
11
|
|
|
|
|
30
|
my ($got, $exists) = @params{qw/got exists/}; |
36
|
|
|
|
|
|
|
|
37
|
11
|
100
|
|
|
|
29
|
return 0 unless $exists; |
38
|
|
|
|
|
|
|
|
39
|
10
|
|
|
|
|
19
|
my $in = $self->{+INPUT}; |
40
|
10
|
100
|
|
|
|
25
|
my $got_type = rtype($got) or return 0; |
41
|
|
|
|
|
|
|
|
42
|
8
|
100
|
|
|
|
25
|
return 0 unless $got_type eq 'REGEXP'; |
43
|
|
|
|
|
|
|
|
44
|
7
|
|
|
|
|
46
|
return "$in" eq "$got"; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
1; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
__END__ |