line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Stream::Compare::Pattern; |
2
|
100
|
|
|
100
|
|
659
|
use strict; |
|
100
|
|
|
|
|
113
|
|
|
100
|
|
|
|
|
2282
|
|
3
|
100
|
|
|
100
|
|
330
|
use warnings; |
|
100
|
|
|
|
|
119
|
|
|
100
|
|
|
|
|
2022
|
|
4
|
|
|
|
|
|
|
|
5
|
100
|
|
|
100
|
|
297
|
use base 'Test::Stream::Compare'; |
|
100
|
|
|
|
|
125
|
|
|
100
|
|
|
|
|
6085
|
|
6
|
100
|
|
|
100
|
|
377
|
use Test::Stream::HashBase accessors => [qw/pattern negate stringify_got/]; |
|
100
|
|
|
|
|
121
|
|
|
100
|
|
|
|
|
582
|
|
7
|
|
|
|
|
|
|
|
8
|
100
|
|
|
100
|
|
406
|
use Carp qw/croak/; |
|
100
|
|
|
|
|
127
|
|
|
100
|
|
|
|
|
17524
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub init { |
11
|
563
|
|
|
563
|
0
|
826
|
my $self = shift; |
12
|
|
|
|
|
|
|
|
13
|
563
|
100
|
|
|
|
1317
|
croak "'pattern' is a required attribute" unless $self->{+PATTERN}; |
14
|
|
|
|
|
|
|
|
15
|
562
|
|
100
|
|
|
1094
|
$self->{+STRINGIFY_GOT} ||= 0; |
16
|
|
|
|
|
|
|
|
17
|
562
|
|
|
|
|
1566
|
$self->SUPER::init(); |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
8
|
|
|
8
|
1
|
37
|
sub name { shift->{+PATTERN} . "" } |
21
|
8
|
100
|
|
8
|
1
|
29
|
sub operator { shift->{+NEGATE} ? '!~' : '=~' } |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub verify { |
24
|
590
|
|
|
590
|
1
|
847
|
my $self = shift; |
25
|
590
|
|
|
|
|
1136
|
my %params = @_; |
26
|
590
|
|
|
|
|
812
|
my ($got, $exists) = @params{qw/got exists/}; |
27
|
|
|
|
|
|
|
|
28
|
590
|
100
|
|
|
|
924
|
return 0 unless $exists; |
29
|
588
|
100
|
|
|
|
895
|
return 0 unless defined($got); |
30
|
586
|
100
|
100
|
|
|
1116
|
return 0 if ref $got && !$self->stringify_got; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
return $got !~ $self->{+PATTERN} |
33
|
584
|
100
|
|
|
|
1106
|
if $self->{+NEGATE}; |
34
|
|
|
|
|
|
|
|
35
|
571
|
|
|
|
|
3897
|
return $got =~ $self->{+PATTERN}; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
1; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
__END__ |