blib/lib/Test/Mojo/Role/Debug.pm

filter: Statementstmt 97.0% 33 / 34 Branchbran 90.0% 9 / 10 Conditioncond 61.5% 8 / 13 MC/DCmcdc 42.8% 3 / 7 Subroutinesub 100% 8 / 8 Podpod 100% 2 / 2 totaltotal 85.1% 63 / 74 CC 11 SCAR 18.9
CC
11
Cov
88%
da
11.0
d
2.0
BEGIN
1.0
CRAP 6.6
↑ Summary
1 package Test::Mojo::Role::Debug;
2  
3 2 ▶use Mojo::Base -base;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use Mojo::File qw/path/;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use Mojo::Util qw/encode/;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 ▶use Role::Tiny;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 ▶use Carp qw/croak/;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 ▶use Test::More ();
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 2 our $VERSION = '1.005003'; # VERSION
11  
12 11 ▶sub d {
Subroutine d: called CC=2 SCAR=6.9
Pod documented
13 11 my ( $self, $selector, $dump_file ) = @_;
14 11 ▶ return $self->success ? $self : $self->da( $selector, $dump_file );
Branch: 1 branch
BranchTrueFalseTotal
$self->success ? : 5 6 11
15 }
16  
17 8 ▶sub da {
Subroutine da: called CC=10 SCAR=23.9
Pod documented
18 8 my ( $self, $selector, $dump_file ) = @_;
19 8 ▶ my $markup = length($selector//'')
Branch: 1 branch
BranchTrueFalseTotal
length($selector // '') ? : 6 2 8
Condition100%2/2
$selector // ""
l!l
71
MC/DC100%1/1
$selector // ""
$selector
Truth table100%2/2
A
A= $selector
Aresult
11
00
20 ? $self->tx->res->dom->at($selector)
21 : $self->tx->res->dom;
22  
23 8 ▶ unless ( defined $markup and length $markup ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $markup and length $markup) 4 4 8
Condition66%2/3
defined $markup and length $markup
!ll&&!rl&&r
404
MC/DC50%1/2
defined $markup and length $markup
defined $markup length $markup
Truth table66%2/3
A and B
A= defined $markupB= length $markup
ABresult
0X0
100
111
24 4 Test::More::diag "\nDEBUG DUMPER: the selector ($selector) you provided "
25 . "did not match any elements\n\n";
26 4 return $self;
27 }
28  
29 4 ▶ if ($markup =~ /<!-- Request ID: \S+ -->/
Branch: 1 branch
BranchTrueFalseTotal
if ($markup =~ /<!-- Request ID: \S+ -->/u and $markup->at("div#mojobar div#mojobar-links") and my $mojo_error = $markup->at("div#wrapperlicious pre#error")) 0 4 4
Condition33%2/6
$markup =~ /<!-- Request ID: \S+ -->/u and $markup->at("div#mojobar div#mojobar-links") and my $mojo_error = $markup->at("div#wrapperlicious pre#error")
!ll&&!rl&&r
400
$markup =~ /<!-- Request ID: \S+ -->/u and $markup->at("div#mojobar div#mojobar-links")
!ll&&!rl&&r
400
MC/DC0%0/3
$markup =~ /<!-- Request ID: \S+ -->/u and $markup->at("div#mojobar div#mojobar-links") and my $mojo_error = $markup->at("div#wrapperlicious pre#error")
$markup =~ /<!-- Request ID: \S+ -->/u $markup->at("div#mojobar div#mojobar-links") my $mojo_error = $markup->at("div#wrapperlicious pre#error")
Truth table25%1/4
A and B and C
A= $markup =~ /<!-- Request ID: \S+ -->/uB= $markup->at("div#mojobar div#mojobar-links")C= my $mojo_error = $markup->at("div#wrapperlicious pre#error")
ABCresult
0XX0
10X0
1100
1111
30 and $markup->at('div#mojobar div#mojobar-links')
31 and (my $mojo_error = $markup->at('div#wrapperlicious pre#error'))
32 ) {
33 0 $markup = $mojo_error->all_text;
34 }
35  
36 4 ▶ if (length($dump_file//'')) {
Branch: 1 branch
BranchTrueFalseTotal
if (length($dump_file // '')) { } 2 2 4
Condition100%2/2
$dump_file // ""
l!l
22
MC/DC100%1/1
$dump_file // ""
$dump_file
Truth table100%2/2
A
A= $dump_file
Aresult
11
00
37 2 Test::More::diag "\nDEBUG DUMPER: dumping data to $dump_file\n\n";
38 2 path($dump_file)->spurt(encode 'utf-8', $markup);
39 }
40 else {
41 2 Test::More::diag "\nDEBUG DUMPER:\n$markup\n\n";
42 }
43  
44 4 $self;
45 }
46  
47 2 q|
48 The optimist says: "The glass is half full"
49 The pessimist says: "The glass is half empty"
50 The programmer says: "The glass is twice as large necessary"
51 |;
52  
53 __END__
↑ Summary