blib/lib/Test2/Tools/Subtest.pm

filter: Statementstmt 100% 34 / 34 Branchbran 62.5% 5 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod 100% 2 / 2 totaltotal 94.1% 48 / 51 CC 5 SCAR 7.4
CC
5
Cov
93%
subtest_streamed
3.0
subtest_buffered
3.0
BEGIN
1.0
CRAP 2.1
« blib/lib/Test2/Compare/Regex.pm ↑ Summary blib/lib/Test2/IPC/Driver.pm »
1 package Test2::Tools::Subtest;
2 165 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 165 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 165 our $VERSION = '1.302226';
6  
7 165 ▶use Test2::API qw/context run_subtest/;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 165 ▶use Test2::Util qw/try/;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 165 our @EXPORT = qw/subtest_streamed subtest_buffered/;
11 165 ▶use base 'Exporter';
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 10 ▶sub subtest_streamed {
Subroutine subtest_streamed: called CC=3 SCAR=11.1
Pod documented
14 10 my $name = shift;
15 10 ▶ my $params = ref($_[0]) eq 'HASH' ? shift(@_) : {};
Branch: 1 branch
BranchTrueFalseTotal
ref $_[0] eq 'HASH' ? : 0 10 10
16 10 my $code = shift;
17  
18 10 ▶ $params->{buffered} = 0 unless defined $params->{buffered};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $params->{"buffered"} 10 0 10
19  
20 10 my $ctx = context();
21 10 my $pass = run_subtest("Subtest: $name", $code, $params, @_);
22 9 $ctx->release;
23 9 return $pass;
24 }
25  
26 231 ▶sub subtest_buffered {
Subroutine subtest_buffered: called CC=3 SCAR=11.0
Pod documented
27 231 my $name = shift;
28 231 ▶ my $params = ref($_[0]) eq 'HASH' ? shift(@_) : {};
Branch: 1 branch
BranchTrueFalseTotal
ref $_[0] eq 'HASH' ? : 1 230 231
29 231 my $code = shift;
30  
31 231 ▶ $params->{buffered} = 1 unless defined $params->{buffered};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $params->{"buffered"} 231 0 231
32  
33 231 my $ctx = context();
34 231 my $pass = run_subtest($name, $code, $params, @_);
35 213 $ctx->release;
36 213 return $pass;
37 }
38  
39 165 1;
40  
41 __END__
« blib/lib/Test2/Compare/Regex.pm ↑ Summary blib/lib/Test2/IPC/Driver.pm »