line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Stream::Compare::Pattern; |
2
|
100
|
|
|
100
|
|
1059
|
use strict; |
|
100
|
|
|
|
|
200
|
|
|
100
|
|
|
|
|
2598
|
|
3
|
100
|
|
|
100
|
|
506
|
use warnings; |
|
100
|
|
|
|
|
302
|
|
|
100
|
|
|
|
|
2500
|
|
4
|
|
|
|
|
|
|
|
5
|
100
|
|
|
100
|
|
538
|
use Test::Stream::Compare; |
|
100
|
|
|
|
|
197
|
|
|
100
|
|
|
|
|
685
|
|
6
|
|
|
|
|
|
|
use Test::Stream::HashBase( |
7
|
100
|
|
|
|
|
772
|
base => 'Test::Stream::Compare', |
8
|
|
|
|
|
|
|
accessors => [qw/pattern negate/], |
9
|
100
|
|
|
100
|
|
524
|
); |
|
100
|
|
|
|
|
187
|
|
10
|
|
|
|
|
|
|
|
11
|
100
|
|
|
100
|
|
563
|
use Carp qw/croak/; |
|
100
|
|
|
|
|
197
|
|
|
100
|
|
|
|
|
24105
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub init { |
14
|
536
|
|
|
536
|
0
|
834
|
my $self = shift; |
15
|
|
|
|
|
|
|
|
16
|
536
|
100
|
|
|
|
1817
|
croak "'pattern' is a required attribute" unless $self->{+PATTERN}; |
17
|
|
|
|
|
|
|
|
18
|
535
|
|
|
|
|
1926
|
$self->SUPER::init(); |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
7
|
|
|
7
|
1
|
66
|
sub name { shift->{+PATTERN} . "" } |
22
|
7
|
100
|
|
7
|
1
|
38
|
sub operator { shift->{+NEGATE} ? '!~' : '=~' } |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub verify { |
25
|
563
|
|
|
563
|
1
|
870
|
my $self = shift; |
26
|
563
|
|
|
|
|
1776
|
my %params = @_; |
27
|
563
|
|
|
|
|
1194
|
my ($got, $exists) = @params{qw/got exists/}; |
28
|
|
|
|
|
|
|
|
29
|
563
|
100
|
|
|
|
1723
|
return 0 unless $exists; |
30
|
561
|
100
|
|
|
|
1282
|
return 0 if ref $got; |
31
|
559
|
100
|
|
|
|
1240
|
return 0 unless defined($got); |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
return $got !~ $self->{+PATTERN} |
34
|
557
|
100
|
|
|
|
1452
|
if $self->{+NEGATE}; |
35
|
|
|
|
|
|
|
|
36
|
544
|
|
|
|
|
5219
|
return $got =~ $self->{+PATTERN}; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
1; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
__END__ |