File Coverage

inc/Test2/Event/Subtest.pm
Criterion Covered Total %
statement 14 45 31.1
branch 0 14 0.0
condition 0 10 0.0
subroutine 5 9 55.5
pod 1 3 33.3
total 20 81 24.6


line stmt bran cond sub pod time code
1             #line 1
2 6     6   41 package Test2::Event::Subtest;
  6         11  
  6         167  
3 6     6   37 use strict;
  6         13  
  6         312  
4             use warnings;
5              
6             our $VERSION = '1.302073';
7              
8 6     6   32  
  6         279  
9 6     6   88 BEGIN { require Test2::Event::Ok; our @ISA = qw(Test2::Event::Ok) }
  6         10  
  6         41  
10             use Test2::Util::HashBase qw{subevents buffered subtest_id};
11              
12 0     0 0   sub init {
13 0           my $self = shift;
14 0   0       $self->SUPER::init();
15 0 0         $self->{+SUBEVENTS} ||= [];
16 0           if ($self->{+EFFECTIVE_PASS}) {
  0            
  0            
17             $_->set_effective_pass(1) for grep { $_->can('effective_pass') } @{$self->{+SUBEVENTS}};
18             }
19             }
20              
21 6     6   43 {
  6         22  
  6         2326  
22             no warnings 'redefine';
23              
24 0     0     sub set_subevents {
25 0           my $self = shift;
26             my @subevents = @_;
27 0 0          
28 0           if ($self->{+EFFECTIVE_PASS}) {
  0            
29             $_->set_effective_pass(1) for grep { $_->can('effective_pass') } @subevents;
30             }
31 0            
32             $self->{+SUBEVENTS} = \@subevents;
33             }
34              
35 0     0 0   sub set_effective_pass {
36 0           my $self = shift;
37             my ($pass) = @_;
38 0 0 0        
    0          
39 0           if ($pass) {
  0            
  0            
40             $_->set_effective_pass(1) for grep { $_->can('effective_pass') } @{$self->{+SUBEVENTS}};
41             }
42 0           elsif ($self->{+EFFECTIVE_PASS} && !$pass) {
  0            
  0            
43 0 0 0       for my $s (grep { $_->can('effective_pass') } @{$self->{+SUBEVENTS}}) {
44             $_->set_effective_pass(0) unless $s->can('todo') && defined $s->todo;
45             }
46             }
47 0            
48             $self->{+EFFECTIVE_PASS} = $pass;
49             }
50             }
51              
52 0     0 1   sub summary {
53             my $self = shift;
54 0   0        
55             my $name = $self->{+NAME} || "Nameless Subtest";
56 0            
57 0 0         my $todo = $self->{+TODO};
    0          
58 0           if ($todo) {
59             $name .= " (TODO: $todo)";
60             }
61 0           elsif (defined $todo) {
62             $name .= " (TODO)"
63             }
64 0            
65             return $name;
66             }
67              
68             1;
69              
70             __END__