| 1 | 6 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 2 | 6 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 3 | |||||||||||||
| 4 | package Test::Deep::Regexp 1.205; | ||||||||||||
| 5 | |||||||||||||
| 6 | 6 | ▶ | use Test::Deep::Cmp; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 7 | 6 | ▶ | use Test::Deep::RegexpMatches; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 8 | |||||||||||||
| 9 | sub init | ||||||||||||
| 10 | 30 | ▶ | { | ||||||||||
|
Subroutine
init: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||
| 11 | 30 | my $self = shift; | |||||||||||
| 12 | |||||||||||||
| 13 | 30 | my $val = shift; | |||||||||||
| 14 | |||||||||||||
| 15 | 30 | ▶ | $val = ref $val ? $val : qr/$val/; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 16 | |||||||||||||
| 17 | 30 | $self->{val} = $val; | |||||||||||
| 18 | |||||||||||||
| 19 | 30 | ▶ | if (my $matches = shift) | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 20 | { | ||||||||||||
| 21 | 5 | $self->{matches} = Test::Deep::regexpmatches($matches, $val); | |||||||||||
| 22 | |||||||||||||
| 23 | 5 | ▶ | $self->{flags} = shift || ""; | ||||||||||
|
Condition100%2/2
shift() || ''
MC/DC100%1/1
shift() || ''
shift()
Truth table100%2/2
A
A= shift()
| |||||||||||||
| 24 | } | ||||||||||||
| 25 | } | ||||||||||||
| 26 | |||||||||||||
| 27 | sub descend | ||||||||||||
| 28 | 37 | ▶ | { | ||||||||||
|
Subroutine
descend: called CC=5 SCAR=16.1
Pod
undocumented
| |||||||||||||
| 29 | 37 | my $self = shift; | |||||||||||
| 30 | 37 | my $got = shift; | |||||||||||
| 31 | |||||||||||||
| 32 | 37 | my $re = $self->{val}; | |||||||||||
| 33 | 37 | ▶ | if (my $match_exp = $self->{matches}) | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 34 | { | ||||||||||||
| 35 | 5 | my $flags = $self->{flags}; | |||||||||||
| 36 | 5 | my @match_got; | |||||||||||
| 37 | 5 | ▶ | if ($flags eq "g") | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 38 | { | ||||||||||||
| 39 | 4 | @match_got = $got =~ /$re/g; | |||||||||||
| 40 | } | ||||||||||||
| 41 | else | ||||||||||||
| 42 | { | ||||||||||||
| 43 | 1 | @match_got = $got =~ /$re/; | |||||||||||
| 44 | } | ||||||||||||
| 45 | |||||||||||||
| 46 | 5 | ▶ | if (@match_got) | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 47 | { | ||||||||||||
| 48 | 5 | return Test::Deep::descend(\@match_got, $match_exp); | |||||||||||
| 49 | } | ||||||||||||
| 50 | else | ||||||||||||
| 51 | { | ||||||||||||
| 52 | 0 | return 0; | |||||||||||
| 53 | } | ||||||||||||
| 54 | } | ||||||||||||
| 55 | else | ||||||||||||
| 56 | { | ||||||||||||
| 57 | 32 | ▶ | return ($got =~ $re) ? 1 : 0; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 58 | } | ||||||||||||
| 59 | } | ||||||||||||
| 60 | |||||||||||||
| 61 | sub diag_message | ||||||||||||
| 62 | 7 | ▶ | { | ||||||||||
|
Subroutine
diag_message: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||
| 63 | 7 | my $self = shift; | |||||||||||
| 64 | |||||||||||||
| 65 | 7 | my $where = shift; | |||||||||||
| 66 | |||||||||||||
| 67 | 7 | return "Using Regexp on $where"; | |||||||||||
| 68 | } | ||||||||||||
| 69 | |||||||||||||
| 70 | sub render_stack1 | ||||||||||||
| 71 | 0 | ▶ | { | ||||||||||
|
Subroutine
render_stack1: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||
| 72 | 0 | my $self = shift; | |||||||||||
| 73 | |||||||||||||
| 74 | 0 | my $stack = shift; | |||||||||||
| 75 | 0 | return "($stack =~ $self->{regex})"; | |||||||||||
| 76 | } | ||||||||||||
| 77 | |||||||||||||
| 78 | sub renderExp | ||||||||||||
| 79 | 8 | ▶ | { | ||||||||||
|
Subroutine
renderExp: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||
| 80 | 8 | my $self = shift; | |||||||||||
| 81 | |||||||||||||
| 82 | 8 | return "$self->{val}"; | |||||||||||
| 83 | } | ||||||||||||
| 84 | |||||||||||||
| 85 | sub renderGot | ||||||||||||
| 86 | 7 | ▶ | { | ||||||||||
|
Subroutine
renderGot: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||
| 87 | 7 | my $self = shift; | |||||||||||
| 88 | 7 | my $got = shift; | |||||||||||
| 89 | |||||||||||||
| 90 | 7 | ▶ | if (defined (my $class = Scalar::Util::blessed($got))) | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 91 | { | ||||||||||||
| 92 | 1 | my $ostr = qq{$got}; | |||||||||||
| 93 | 1 | ▶ | if ($ostr ne overload::StrVal($got)) | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 94 | { | ||||||||||||
| 95 | 1 | return qq{'$ostr' (instance of $class)}; | |||||||||||
| 96 | } | ||||||||||||
| 97 | } | ||||||||||||
| 98 | |||||||||||||
| 99 | 6 | return Test::Deep::render_val($got); | |||||||||||
| 100 | } | ||||||||||||
| 101 | |||||||||||||
| 102 | 6 | 1; | |||||||||||
| 103 | |||||||||||||
| 104 | __END__ | ||||||||||||