| 1 | package Test2::Event::Ok; | ||||||||||||||||||||||||||||||||||||||||||
| 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 | |||||||||||||||||||||||||||||||||||||||||||
| 8 | 455 | ▶ | BEGIN { require Test2::Event; our @ISA = qw(Test2::Event) } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | 455 | ▶ | use Test2::Util::HashBase qw{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | pass effective_pass name todo | ||||||||||||||||||||||||||||||||||||||||||
| 11 | 455 | }; | |||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||
| 13 | 3484 | ▶ | sub init { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
init: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 14 | 3484 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||
| 16 | # Do not store objects here, only true or false | ||||||||||||||||||||||||||||||||||||||||||
| 17 | 3484 | ▶ | $self->{+PASS} = $self->{+PASS} ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 18 | 3484 | ▶ | $self->{+EFFECTIVE_PASS} = $self->{+PASS} || (defined($self->{+TODO}) ? 1 : 0); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$self->{'pass'} || (defined $self->{'todo'} ? 1 : 0)
MC/DC100%2/2
$self->{'pass'} || (defined $self->{'todo'} ? 1 : 0)
$self->{'pass'}
(defined $self->{'todo'} ? 1 : 0)
Truth table100%3/3
A || B
A= $self->{'pass'}B= (defined $self->{'todo'} ? 1 : 0)
| |||||||||||||||||||||||||||||||||||||||||||
| 19 | } | ||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||
| 21 | { | ||||||||||||||||||||||||||||||||||||||||||
| 22 | 455 | ▶ | no warnings 'redefine'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 23 | 327 | ▶ | sub set_todo { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_todo: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 24 | 327 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 25 | 327 | my ($todo) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 26 | 327 | $self->{+TODO} = $todo; | |||||||||||||||||||||||||||||||||||||||||
| 27 | 327 | ▶ | $self->{+EFFECTIVE_PASS} = defined($todo) ? 1 : $self->{+PASS}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||
| 31 | 3 | ▶ | sub increments_count { 1 }; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
increments_count: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||
| 33 | 4 | ▶ | sub causes_fail { !$_[0]->{+EFFECTIVE_PASS} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
causes_fail: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||
| 35 | 7 | ▶ | sub summary { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
summary: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 36 | 7 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||
| 38 | 7 | ▶ | my $name = $self->{+NAME} || "Nameless Assertion"; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->{'name'} || 'Nameless Assertion'
MC/DC100%1/1
$self->{'name'} || 'Nameless Assertion'
$self->{'name'}
Truth table100%2/2
A
A= $self->{'name'}
| |||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||
| 40 | 7 | my $todo = $self->{+TODO}; | |||||||||||||||||||||||||||||||||||||||||
| 41 | 7 | ▶ | if ($todo) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 42 | 1 | $name .= " (TODO: $todo)"; | |||||||||||||||||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||||||||||||||||
| 44 | elsif (defined $todo) { | ||||||||||||||||||||||||||||||||||||||||||
| 45 | 1 | $name .= " (TODO)" | |||||||||||||||||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||
| 48 | 7 | return $name; | |||||||||||||||||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||
| 51 | 6980 | ▶ | sub extra_amnesty { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
extra_amnesty: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 52 | 6980 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 53 | 6980 | ▶ | return unless defined($self->{+TODO}) || ($self->{+EFFECTIVE_PASS} && !$self->{+PASS}); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
defined $self->{"todo"} or $self->{"effective_pass"} and not $self->{"pass"}
$self->{"effective_pass"} and not $self->{"pass"}
MC/DC100%3/3
defined $self->{"todo"} or $self->{"effective_pass"} and not $self->{"pass"}
defined $self->{"todo"}
$self->{"effective_pass"}
not $self->{"pass"}
Truth table100%4/4
A or B and not(C)
A= defined $self->{"todo"}B= $self->{"effective_pass"}C= not $self->{"pass"}
| |||||||||||||||||||||||||||||||||||||||||||
| 54 | return { | ||||||||||||||||||||||||||||||||||||||||||
| 55 | tag => 'TODO', | ||||||||||||||||||||||||||||||||||||||||||
| 56 | 476 | details => $self->{+TODO}, | |||||||||||||||||||||||||||||||||||||||||
| 57 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||
| 60 | 7489 | ▶ | sub facet_data { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
facet_data: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 61 | 7489 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||
| 63 | 7489 | my $out = $self->common_facet_data; | |||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||
| 65 | $out->{assert} = { | ||||||||||||||||||||||||||||||||||||||||||
| 66 | no_debug => 1, # Legacy behavior | ||||||||||||||||||||||||||||||||||||||||||
| 67 | pass => $self->{+PASS}, | ||||||||||||||||||||||||||||||||||||||||||
| 68 | 7489 | details => $self->{+NAME}, | |||||||||||||||||||||||||||||||||||||||||
| 69 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||
| 71 | 7489 | ▶ | if (my @extra_amnesty = $self->extra_amnesty) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 72 | 985 | my %seen; | |||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||
| 74 | # It is possible the extra amnesty can be a duplicate, so filter it. | ||||||||||||||||||||||||||||||||||||||||||
| 75 | $out->{amnesty} = [ | ||||||||||||||||||||||||||||||||||||||||||
| 76 | 1278 | ▶ | grep { !$seen{defined($_->{tag}) ? $_->{tag} : ''}->{defined($_->{details}) ? $_->{details} : ''}++ } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 77 | @extra_amnesty, | ||||||||||||||||||||||||||||||||||||||||||
| 78 | 985 | @{$out->{amnesty}}, | |||||||||||||||||||||||||||||||||||||||||
| 79 | ]; | ||||||||||||||||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||
| 82 | 7489 | return $out; | |||||||||||||||||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||
| 85 | 455 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||||||||||||
| 87 | __END__ | ||||||||||||||||||||||||||||||||||||||||||