Perlito5X/Test2/Event/Ok.pm untested

filter: Statementstmt 0.0% 0 / 34 Branchbran 0.0% 0 / 10 Conditioncond 0.0% 0 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 0.0% 0 / 11 Podpod 0.0% 0 / 6 totaltotal 0.0% 0 / 69 CC 6 SCAR 18.3
CC
6
Cov
0%
init
12.0
summary
12.0
set_todo
6.0
CRAP 6.2
1 package Test2::Event::Ok;
2 use strict;
3 use warnings;
4  
5 our $VERSION = '1.302073';
6  
7  
8 BEGIN { require Test2::Event; our @ISA = qw(Test2::Event) }
9 use Test2::Util::HashBase qw{
10 pass effective_pass name todo
11 };
12  
13 sub init {
14 my $self = shift;
15  
16 # Do not store objects here, only true or false
17 $self->{+PASS} = $self->{+PASS} ? 1 : 0;
18 $self->{+EFFECTIVE_PASS} = $self->{+PASS} || (defined($self->{+TODO}) ? 1 : 0);
19 }
20  
21 {
22 no warnings 'redefine';
23 sub set_todo {
24 my $self = shift;
25 my ($todo) = @_;
26 $self->{+TODO} = $todo;
27 $self->{+EFFECTIVE_PASS} = defined($todo) ? 1 : $self->{+PASS};
28 }
29 }
30  
31 sub increments_count { 1 };
32  
33 sub causes_fail { !$_[0]->{+EFFECTIVE_PASS} }
34  
35 sub summary {
36 my $self = shift;
37  
38 my $name = $self->{+NAME} || "Nameless Assertion";
39  
40 my $todo = $self->{+TODO};
41 if ($todo) {
42 $name .= " (TODO: $todo)";
43 }
44 elsif (defined $todo) {
45 $name .= " (TODO)"
46 }
47  
48 return $name;
49 }
50  
51 1;
52  
53 __END__