line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test2::Harness::Result; |
2
|
26
|
|
|
26
|
|
124526
|
use strict; |
|
26
|
|
|
|
|
4
|
|
|
26
|
|
|
|
|
542
|
|
3
|
26
|
|
|
26
|
|
78
|
use warnings; |
|
26
|
|
|
|
|
26
|
|
|
26
|
|
|
|
|
921
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.000013'; |
6
|
|
|
|
|
|
|
|
7
|
26
|
|
|
26
|
|
78
|
use Carp qw/croak/; |
|
26
|
|
|
|
|
5
|
|
|
26
|
|
|
|
|
1283
|
|
8
|
26
|
|
|
26
|
|
548
|
use Time::HiRes qw/time/; |
|
26
|
|
|
|
|
1026
|
|
|
26
|
|
|
|
|
125
|
|
9
|
|
|
|
|
|
|
|
10
|
26
|
|
|
|
|
105
|
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
|
|
2288
|
}; |
|
26
|
|
|
|
|
28
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub init { |
23
|
661
|
|
|
661
|
0
|
135393
|
my $self = shift; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
croak "'file' is a required attribute" |
26
|
661
|
100
|
|
|
|
1998
|
unless $self->{+FILE}; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
croak "'job' is a required attribute" |
29
|
659
|
100
|
|
|
|
2055
|
unless $self->{+JOB}; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
croak "'name' is a required attribute" |
32
|
657
|
100
|
|
|
|
1657
|
unless $self->{+NAME}; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
# Overall stuff |
35
|
655
|
|
33
|
|
|
3970
|
$self->{+START_TIME} ||= time; |
36
|
655
|
|
50
|
|
|
3151
|
$self->{+TOTAL} ||= 0; |
37
|
655
|
|
50
|
|
|
2692
|
$self->{+FAILED} ||= 0; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
# Plan related |
40
|
655
|
|
50
|
|
|
3159
|
$self->{+PLANS} ||= []; |
41
|
|
|
|
|
|
|
|
42
|
655
|
|
50
|
|
|
4017
|
$self->{+EVENTS} ||= []; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub stop { |
46
|
611
|
|
|
611
|
1
|
3795
|
my $self = shift; |
47
|
611
|
|
|
|
|
720
|
my ($exit) = @_; |
48
|
|
|
|
|
|
|
|
49
|
611
|
|
|
|
|
2549
|
$self->{+STOP_TIME} = time; |
50
|
611
|
|
|
|
|
1362
|
$self->{+EXIT} = $exit; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub passed { |
54
|
2535
|
|
|
2535
|
1
|
4087
|
my $self = shift; |
55
|
2535
|
100
|
|
|
|
4191
|
return unless defined $self->{+STOP_TIME}; |
56
|
|
|
|
|
|
|
|
57
|
2533
|
100
|
|
|
|
3894
|
return 0 if $self->{+EXIT}; |
58
|
2531
|
100
|
|
|
|
3585
|
return 0 if $self->{+FAILED}; |
59
|
2529
|
|
|
|
|
8745
|
return 1; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub ran_tests { |
63
|
1803
|
|
|
1803
|
1
|
4588
|
my $self = shift; |
64
|
|
|
|
|
|
|
|
65
|
1803
|
|
|
|
|
1603
|
my $plans = $self->{+PLANS}; |
66
|
1803
|
100
|
33
|
|
|
9376
|
return 0 if $plans && @$plans && $plans->[0]->directive eq 'SKIP'; |
|
|
|
66
|
|
|
|
|
67
|
1689
|
50
|
|
|
|
6485
|
return 0 unless grep { $_->increments_count } @{$self->{+EVENTS}}; |
|
57141
|
|
|
|
|
105547
|
|
|
1689
|
|
|
|
|
3257
|
|
68
|
1689
|
|
|
|
|
7419
|
return 1; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
4
|
|
100
|
4
|
1
|
688
|
sub bump_failed { $_[0]->{+FAILED} += $_[1] || 1 } |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub add_events { |
74
|
15650
|
|
|
15650
|
1
|
12392
|
my $self = shift; |
75
|
15650
|
|
|
|
|
34602
|
$self->add_event($_) for @_; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub add_event { |
79
|
19318
|
|
|
19318
|
1
|
31856
|
my $self = shift; |
80
|
19318
|
|
|
|
|
15417
|
my ($e) = @_; |
81
|
|
|
|
|
|
|
|
82
|
19318
|
|
|
|
|
15705
|
push @{$self->{+EVENTS}} => $e; |
|
19318
|
|
|
|
|
27689
|
|
83
|
|
|
|
|
|
|
|
84
|
19318
|
100
|
100
|
|
|
32263
|
return unless ($e->nested || 0) <= 0; |
85
|
|
|
|
|
|
|
|
86
|
5015
|
100
|
|
|
|
33771
|
$self->{+TOTAL}++ if $e->increments_count; |
87
|
5015
|
100
|
|
|
|
28174
|
if ($e->isa('Test2::Event::Plan')) { |
88
|
611
|
|
|
|
|
1830
|
my @set = $e->sets_plan; |
89
|
611
|
100
|
100
|
|
|
4361
|
push @{$self->{+PLANS}}, $e unless $set[1] && $set[1] eq 'NO PLAN'; |
|
609
|
|
|
|
|
2122
|
|
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
5015
|
100
|
100
|
|
|
10488
|
$self->{+FAILED}++ if $e->causes_fail || $e->terminate; |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
1; |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
__END__ |