blib/lib/Test2/Compare/Pattern.pm

filter: Statementstmt 100% 34 / 34 Branchbran 100% 12 / 12 Conditioncond 100% 5 / 5 MC/DCmcdc 100% 3 / 3 Subroutinesub 100% 10 / 10 Podpod 75.0% 3 / 4 totaltotal 98.5% 67 / 68 CC 9 SCAR 11.3
CC
9
Cov
100%
verify
6.0
init
3.0
operator
2.0
CRAP 3.1
« blib/lib/Test2/API/InterceptResult.pm ↑ Summary blib/lib/Test2/Compare/Meta.pm »
1 package Test2::Compare::Pattern;
2 176 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 176 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 176 ▶use base 'Test2::Compare::Base';
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 176 our $VERSION = '1.302226';
8  
9 176 ▶use Test2::Util::HashBase qw/pattern stringify_got/;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 # Overloads '!' for us.
12 176 ▶use Test2::Compare::Negatable;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 176 ▶use Carp qw/croak/;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 462 ▶sub init {
Subroutine init: called CC=3 SCAR=11.0
Pod undocumented
17 462 my $self = shift;
18  
19 462 ▶ croak "'pattern' is a required attribute" unless $self->{+PATTERN};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"pattern"} 1 461 462
20  
21 461 ▶ $self->{+STRINGIFY_GOT} ||= 0;
Condition100%2/2
$self->{"stringify_got"} ||= 0
l!l
252209
MC/DC100%1/1
$self->{"stringify_got"} ||= 0
$self->{"stringify_got"}
Truth table100%2/2
A
A= $self->{"stringify_got"}
Aresult
11
00
22  
23 461 $self->SUPER::init();
24 }
25  
26 22 ▶sub name { shift->{+PATTERN} . "" }
Subroutine name: called CC=1 SCAR=0.0
Pod documented
27 22 ▶sub operator { shift->{+NEGATE} ? '!~' : '=~' }
Subroutine operator: called CC=2 SCAR=6.9
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
+(shift())->{'negate'} ? : 4 18 22
28  
29 515 ▶sub verify {
Subroutine verify: called CC=6 SCAR=17.9
Pod documented
30 515 my $self = shift;
31 515 my %params = @_;
32 515 my ($got, $exists) = @params{qw/got exists/};
33  
34 515 ▶ return 0 unless $exists;
Branch: 1 branch
BranchTrueFalseTotal
unless $exists 2 513 515
35 513 ▶ return 0 unless defined($got);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $got 2 511 513
36 511 ▶ return 0 if ref $got && !$self->stringify_got;
Branch: 1 branch
BranchTrueFalseTotal
if ref $got and not $self->stringify_got 2 509 511
Condition100%3/3
ref $got and not $self->stringify_got
!ll&&!rl&&r
50632
MC/DC100%2/2
ref $got and not $self->stringify_got
ref $got not $self->stringify_got
Truth table100%3/3
A and not(B)
A= ref $gotB= not $self->stringify_got
ABresult
0X0
100
111
37  
38 return $got !~ $self->{+PATTERN}
39 509 ▶ if $self->{+NEGATE};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"negate"} 14 495 509
40  
41 495 return $got =~ $self->{+PATTERN};
42 }
43  
44 176 1;
45  
46 __END__
« blib/lib/Test2/API/InterceptResult.pm ↑ Summary blib/lib/Test2/Compare/Meta.pm »