line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Stream::Compare::Pattern; |
2
|
100
|
|
|
100
|
|
1032
|
use strict; |
|
100
|
|
|
|
|
187
|
|
|
100
|
|
|
|
|
2600
|
|
3
|
100
|
|
|
100
|
|
550
|
use warnings; |
|
100
|
|
|
|
|
199
|
|
|
100
|
|
|
|
|
2509
|
|
4
|
|
|
|
|
|
|
|
5
|
100
|
|
|
100
|
|
656
|
use Test::Stream::Compare; |
|
100
|
|
|
|
|
197
|
|
|
100
|
|
|
|
|
686
|
|
6
|
|
|
|
|
|
|
use Test::Stream::HashBase( |
7
|
100
|
|
|
|
|
790
|
base => 'Test::Stream::Compare', |
8
|
|
|
|
|
|
|
accessors => [qw/pattern negate/], |
9
|
100
|
|
|
100
|
|
529
|
); |
|
100
|
|
|
|
|
185
|
|
10
|
|
|
|
|
|
|
|
11
|
100
|
|
|
100
|
|
550
|
use Carp qw/croak/; |
|
100
|
|
|
|
|
186
|
|
|
100
|
|
|
|
|
24201
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub init { |
14
|
536
|
|
|
536
|
0
|
808
|
my $self = shift; |
15
|
|
|
|
|
|
|
|
16
|
536
|
100
|
|
|
|
1844
|
croak "'pattern' is a required attribute" unless $self->{+PATTERN}; |
17
|
|
|
|
|
|
|
|
18
|
535
|
|
|
|
|
1776
|
$self->SUPER::init(); |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
7
|
|
|
7
|
1
|
49
|
sub name { shift->{+PATTERN} . "" } |
22
|
7
|
100
|
|
7
|
1
|
41
|
sub operator { shift->{+NEGATE} ? '!~' : '=~' } |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub verify { |
25
|
563
|
|
|
563
|
1
|
842
|
my $self = shift; |
26
|
563
|
|
|
|
|
1786
|
my %params = @_; |
27
|
563
|
|
|
|
|
1195
|
my ($got, $exists) = @params{qw/got exists/}; |
28
|
|
|
|
|
|
|
|
29
|
563
|
100
|
|
|
|
1627
|
return 0 unless $exists; |
30
|
561
|
100
|
|
|
|
1301
|
return 0 if ref $got; |
31
|
559
|
100
|
|
|
|
1205
|
return 0 unless defined($got); |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
return $got !~ $self->{+PATTERN} |
34
|
557
|
100
|
|
|
|
1394
|
if $self->{+NEGATE}; |
35
|
|
|
|
|
|
|
|
36
|
544
|
|
|
|
|
5070
|
return $got =~ $self->{+PATTERN}; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
1; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
__END__ |