blib/lib/Test2/Tools/Encoding.pm

filter: Statementstmt 100% 25 / 25 Branchbran 75.0% 3 / 4 Conditioncond 66.6% 2 / 3 MC/DCmcdc 50.0% 1 / 2 Subroutinesub 100% 6 / 6 Podpod 100% 1 / 1 totaltotal 92.6% 38 / 41 CC 4 SCAR 8.6
CC
4
Cov
94%
set_encoding
4.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.4
« blib/lib/Test2/Require.pm ↑ Summary blib/lib/Test2/EventFacet/Info/Table.pm »
1 package Test2::Tools::Encoding;
2 162 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 162 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 162 ▶use Carp qw/croak/;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 162 ▶use Test2::API qw/test2_stack/;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 162 ▶use base 'Exporter';
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 162 our $VERSION = '1.302226';
12  
13 162 our @EXPORT = qw/set_encoding/;
14  
15 2 ▶sub set_encoding {
Subroutine set_encoding: called CC=4 SCAR=14.0
Pod documented
16 2 my $enc = shift;
17 2 my $format = test2_stack->top->format;
18  
19 2 ▶ unless ($format && eval { $format->can('encoding') }) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($format and eval { do { $format->can("encoding") } }) 1 1 2
Condition66%2/3
$format and eval { do { $format->can("encoding") } }
!ll&&!rl&&r
101
MC/DC50%1/2
$format and eval { do { $format->can("encoding") } }
$format eval { do { $format->can("encoding") } }
Truth table66%2/3
A and B
A= $formatB= eval { do { $format->can("encoding") } }
ABresult
0X0
100
111
20 1 ▶ $format = '<undef>' unless defined $format;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $format 1 0 1
21 1 croak "Unable to set encoding on formatter '$format'";
22 }
23  
24 1 $format->encoding($enc);
25 }
26  
27 162 1;
28  
29 __END__
« blib/lib/Test2/Require.pm ↑ Summary blib/lib/Test2/EventFacet/Info/Table.pm »