line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
12
|
|
|
12
|
|
151
|
use v5.14; |
|
12
|
|
|
|
|
45
|
|
2
|
12
|
|
|
12
|
|
83
|
use warnings; |
|
12
|
|
|
|
|
42
|
|
|
12
|
|
|
|
|
657
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package Test::BDD::Cucumber::Model::Result 0.85; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=head1 NAME |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
Test::BDD::Cucumber::Model::Result - Encapsulates a result state |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 VERSION |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
version 0.85 |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 DESCRIPTION |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
Encapsulation of result state - whether that's for a step, scenario, or feature |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=cut |
19
|
|
|
|
|
|
|
|
20
|
12
|
|
|
12
|
|
107
|
use Moo; |
|
12
|
|
|
|
|
47
|
|
|
12
|
|
|
|
|
107
|
|
21
|
12
|
|
|
12
|
|
4416
|
use Types::Standard qw( Enum Str ); |
|
12
|
|
|
|
|
83
|
|
|
12
|
|
|
|
|
107
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head2 result |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
Enum of: C, C, C or C. C is used |
28
|
|
|
|
|
|
|
if there was any TODO output from a test, and C for a test that |
29
|
|
|
|
|
|
|
wasn't run, either due to no matching step, or because a previous step failed. |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=cut |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
has 'result' => ( is => 'ro', isa => Enum[qw( passing failing pending undefined )], required => 1 ); |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head2 output |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
The underlying test-output that contributed to a result. |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=cut |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
has 'output' => ( is => 'ro', isa => Str, required => 1 ); |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head1 METHODS |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head2 from_children |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
Collates the Result objects you pass in, and returns one that encompasses all |
48
|
|
|
|
|
|
|
of them. |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
As they may be varied, it runs through them in order of C, |
51
|
|
|
|
|
|
|
C, C and C - the first it finds is the overall |
52
|
|
|
|
|
|
|
result. The empty set passes. |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=cut |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub from_children { |
57
|
19
|
|
|
19
|
1
|
140
|
my ( $class, @children ) = @_; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
# We'll be looking for the presence of just one of any of the |
60
|
|
|
|
|
|
|
# short-circuiting statuses, but we need to keep a sum of all the output. |
61
|
|
|
|
|
|
|
# Passing is the default state, so we cheat and say there was one of them. |
62
|
19
|
|
|
|
|
70
|
my %results = ( passing => 1 ); |
63
|
19
|
|
|
|
|
35
|
my $output; |
64
|
|
|
|
|
|
|
|
65
|
19
|
|
|
|
|
102
|
for my $child (@children) { |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
# Save the status of that child |
68
|
52
|
|
|
|
|
146
|
$results{ $child->result }++; |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
# Add its output |
71
|
52
|
|
|
|
|
216
|
$output .= $child->output . "\n"; |
72
|
|
|
|
|
|
|
} |
73
|
19
|
|
|
|
|
60
|
$output .= "\n"; |
74
|
|
|
|
|
|
|
|
75
|
19
|
|
|
|
|
66
|
for my $status (qw( failing undefined pending passing )) { |
76
|
61
|
100
|
|
|
|
186
|
if ( $results{$status} ) { |
77
|
19
|
|
|
|
|
465
|
return $class->new( |
78
|
|
|
|
|
|
|
{ |
79
|
|
|
|
|
|
|
result => $status, |
80
|
|
|
|
|
|
|
output => $output |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
); |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
1; |