line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test2::Harness::Result; |
2
|
26
|
|
|
26
|
|
106845
|
use strict; |
|
26
|
|
|
|
|
25
|
|
|
26
|
|
|
|
|
865
|
|
3
|
26
|
|
|
26
|
|
79
|
use warnings; |
|
26
|
|
|
|
|
27
|
|
|
26
|
|
|
|
|
811
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.000012'; |
6
|
|
|
|
|
|
|
|
7
|
26
|
|
|
26
|
|
80
|
use Carp qw/croak/; |
|
26
|
|
|
|
|
26
|
|
|
26
|
|
|
|
|
1398
|
|
8
|
26
|
|
|
26
|
|
522
|
use Time::HiRes qw/time/; |
|
26
|
|
|
|
|
989
|
|
|
26
|
|
|
|
|
128
|
|
9
|
|
|
|
|
|
|
|
10
|
26
|
|
|
|
|
149
|
use Test2::Util::HashBase qw{ |
11
|
|
|
|
|
|
|
file name job |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
total failed |
14
|
|
|
|
|
|
|
start_time stop_time |
15
|
|
|
|
|
|
|
exit |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
plans |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
events |
20
|
26
|
|
|
26
|
|
2744
|
}; |
|
26
|
|
|
|
|
27
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub init { |
23
|
661
|
|
|
661
|
0
|
124470
|
my $self = shift; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
croak "'file' is a required attribute" |
26
|
661
|
100
|
|
|
|
2220
|
unless $self->{+FILE}; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
croak "'job' is a required attribute" |
29
|
659
|
100
|
|
|
|
1769
|
unless $self->{+JOB}; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
croak "'name' is a required attribute" |
32
|
657
|
100
|
|
|
|
1696
|
unless $self->{+NAME}; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
# Overall stuff |
35
|
655
|
|
33
|
|
|
4691
|
$self->{+START_TIME} ||= time; |
36
|
655
|
|
50
|
|
|
3784
|
$self->{+TOTAL} ||= 0; |
37
|
655
|
|
50
|
|
|
2405
|
$self->{+FAILED} ||= 0; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
# Plan related |
40
|
655
|
|
50
|
|
|
2391
|
$self->{+PLANS} ||= []; |
41
|
|
|
|
|
|
|
|
42
|
655
|
|
50
|
|
|
4060
|
$self->{+EVENTS} ||= []; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub stop { |
46
|
611
|
|
|
611
|
1
|
3879
|
my $self = shift; |
47
|
611
|
|
|
|
|
1089
|
my ($exit) = @_; |
48
|
|
|
|
|
|
|
|
49
|
611
|
|
|
|
|
4059
|
$self->{+STOP_TIME} = time; |
50
|
611
|
|
|
|
|
1717
|
$self->{+EXIT} = $exit; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub passed { |
54
|
2649
|
|
|
2649
|
1
|
5957
|
my $self = shift; |
55
|
2649
|
100
|
|
|
|
5999
|
return unless defined $self->{+STOP_TIME}; |
56
|
|
|
|
|
|
|
|
57
|
2647
|
100
|
|
|
|
4698
|
return 0 if $self->{+EXIT}; |
58
|
2645
|
100
|
|
|
|
5021
|
return 0 if $self->{+FAILED}; |
59
|
2643
|
|
|
|
|
10980
|
return 1; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
4
|
|
100
|
4
|
1
|
725
|
sub bump_failed { $_[0]->{+FAILED} += $_[1] || 1 } |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub add_events { |
65
|
15608
|
|
|
15608
|
1
|
15655
|
my $self = shift; |
66
|
15608
|
|
|
|
|
34925
|
$self->add_event($_) for @_; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub add_event { |
70
|
19264
|
|
|
19264
|
1
|
31788
|
my $self = shift; |
71
|
19264
|
|
|
|
|
15046
|
my ($e) = @_; |
72
|
|
|
|
|
|
|
|
73
|
19264
|
|
|
|
|
13084
|
push @{$self->{+EVENTS}} => $e; |
|
19264
|
|
|
|
|
30035
|
|
74
|
|
|
|
|
|
|
|
75
|
19264
|
100
|
100
|
|
|
32322
|
return unless ($e->nested || 0) <= 0; |
76
|
|
|
|
|
|
|
|
77
|
5015
|
100
|
|
|
|
37153
|
$self->{+TOTAL}++ if $e->increments_count; |
78
|
5015
|
100
|
|
|
|
27937
|
if ($e->isa('Test2::Event::Plan')) { |
79
|
611
|
|
|
|
|
2028
|
my @set = $e->sets_plan; |
80
|
611
|
100
|
100
|
|
|
5940
|
push @{$self->{+PLANS}}, $e unless $set[1] && $set[1] eq 'NO PLAN'; |
|
609
|
|
|
|
|
2329
|
|
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
5015
|
100
|
100
|
|
|
11538
|
$self->{+FAILED}++ if $e->causes_fail || $e->terminate; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
1; |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
__END__ |