blib/lib/Test2/Event/Fail.pm

filter: Statementstmt 100% 44 / 44 Branchbran 83.3% 5 / 6 Conditioncond 66.6% 2 / 3 MC/DCmcdc 50.0% 1 / 2 Subroutinesub 100% 16 / 16 Podpod 90.9% 10 / 11 totaltotal 95.1% 78 / 82 CC 6 SCAR 5.1
CC
6
Cov
96%
add_info
3.0
causes_fail
3.0
facet_data
2.0
CRAP 1.7
« lib/Test/Tester/CaptureRunner.pm ↑ Summary blib/lib/Test2/Compare/Undef.pm »
1 package Test2::Event::Fail;
2 455 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 455 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 455 our $VERSION = '1.302226';
6  
7 455 ▶use Test2::EventFacet::Info;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 455 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
10 455 require Test2::Event;
11 455 our @ISA = qw(Test2::Event);
12 455 *META_KEY = \&Test2::Util::ExternalMeta::META_KEY;
13 }
14  
15 455 ▶use Test2::Util::HashBase qw{ -name -info };
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 #############
18 # Old API
19 1 ▶sub summary { "fail" }
Subroutine summary: called CC=1 SCAR=0.0
Pod documented
20 1 ▶sub increments_count { 1 }
Subroutine increments_count: called CC=1 SCAR=0.0
Pod documented
21 1 ▶sub diagnostics { 0 }
Subroutine diagnostics: called CC=1 SCAR=0.0
Pod documented
22 1 ▶sub no_display { 0 }
Subroutine no_display: called CC=1 SCAR=0.0
Pod documented
23 1 ▶sub subtest_id { undef }
Subroutine subtest_id: called CC=1 SCAR=0.0
Pod documented
24 1 ▶sub terminate { () }
Subroutine terminate: called CC=1 SCAR=0.0
Pod documented
25 12 ▶sub global { () }
Subroutine global: called CC=1 SCAR=0.0
Pod documented
26 1 ▶sub sets_plan { () }
Subroutine sets_plan: called CC=1 SCAR=0.0
Pod documented
27  
28 5 ▶sub causes_fail {
Subroutine causes_fail: called CC=3 SCAR=11.0
Pod documented
29 5 my $self = shift;
30 5 ▶ return 0 if $self->{+AMNESTY} && @{$self->{+AMNESTY}};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"amnesty"} and @{$self->{"amnesty"};} 2 3 5
Condition66%2/3
$self->{"amnesty"} and @{$self->{"amnesty"};}
!ll&&!rl&&r
302
MC/DC50%1/2
$self->{"amnesty"} and @{$self->{"amnesty"};}
$self->{"amnesty"} @{$self->{"amnesty"};}
Truth table66%2/3
A and B
A= $self->{"amnesty"}B= @{$self->{"amnesty"};}
ABresult
0X0
100
111
31 3 return 1;
32 }
33  
34 #############
35 # New API
36  
37 256 ▶sub add_info {
Subroutine add_info: called CC=3 SCAR=11.0
Pod undocumented
38 256 my $self = shift;
39  
40 256 for my $in (@_) {
41 256 ▶ $in = {%$in} if ref($in) ne 'ARRAY';
Branch: 1 branch
BranchTrueFalseTotal
if ref $in ne "ARRAY" 256 0 256
42 256 $in = Test2::EventFacet::Info->new($in);
43  
44 256 push @{$self->{+INFO}} => $in;
45 }
46 }
47  
48 420 ▶sub facet_data {
Subroutine facet_data: called CC=2 SCAR=6.9
Pod documented
49 420 my $self = shift;
50 420 my $out = $self->common_facet_data;
51  
52 420 $out->{about}->{details} = 'fail';
53  
54 420 $out->{assert} = {pass => 0, details => $self->{+NAME}};
55  
56 420 ▶ $out->{info} = [map {{ %{$_} }} @{$self->{+INFO}}] if $self->{+INFO};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"info"} 387 33 420
57  
58 420 return $out;
59 }
60  
61 455 1;
62  
63 __END__
« lib/Test/Tester/CaptureRunner.pm ↑ Summary blib/lib/Test2/Compare/Undef.pm »