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

filter: Statementstmt 100% 14 / 14 Branchbran 100% 2 / 2 Conditioncond 50.0% 3 / 6 MC/DCmcdc 33.3% 1 / 3 Subroutinesub 100% 3 / 3 Podpod 100% 1 / 1 totaltotal 82.7% 24 / 29 CC 4 SCAR 11.3
CC
4
Cov
86%
in_DOM
4.2
BEGIN
1.0
BEGIN
1.0
CRAP 3.1
↑ Summary
1 package Test::Mojo::Role::DOMinizer;
2  
3 2 ▶use Mojo::Base -base;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use Role::Tiny;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 2 our $VERSION = '1.001002'; # VERSION
7  
8 2 ▶sub in_DOM {
Subroutine in_DOM: called CC=4 SCAR=14.2
Pod documented
9 2 my ($self, $code) = @_;
10 2 my $res = do {
11 2 local $_ = $self->tx->res->dom;
12 2 $code->($_, $self);
13 };
14  
15 # Don't know a better way to test whether the returned object is
16 # a Test::Mojo when it does arbitrary roles, so doing this hack:
17 2 my $ref = ref $res;
18 2 ▶ $ref && (
Branch: 1 branch
BranchTrueFalseTotal
$ref && ($ref eq 'Test::Mojo' || $ref =~ /^Test::Mojo__WITH__Test::Mojo::Role/u) ? : 1 1 2
Condition50%3/6
$ref and $ref eq "Test::Mojo" || $ref =~ /^Test::Mojo__WITH__Test::Mojo::Role/u
!ll&&!rl&&r
101
$ref eq "Test::Mojo" or $ref =~ /^Test::Mojo__WITH__Test::Mojo::Role/u
l!l&&r!l&&!r
010
MC/DC33%1/3
$ref and $ref eq "Test::Mojo" || $ref =~ /^Test::Mojo__WITH__Test::Mojo::Role/u
$ref $ref eq "Test::Mojo" $ref =~ /^Test::Mojo__WITH__Test::Mojo::Role/u
Truth table50%2/4
A and B or C
A= $refB= $ref eq "Test::Mojo"C= $ref =~ /^Test::Mojo__WITH__Test::Mojo::Role/u
ABCresult
0XX0
1000
11X1
1011
19 $ref eq 'Test::Mojo' or $ref =~ /^Test::Mojo__WITH__Test::Mojo::Role/
20 ) ? $res : $self
21 }
22  
23 2 1;
24 __END__
↑ Summary