line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Stream::Workflow::Meta; |
2
|
95
|
|
|
95
|
|
1044
|
use strict; |
|
95
|
|
|
|
|
176
|
|
|
95
|
|
|
|
|
2407
|
|
3
|
95
|
|
|
95
|
|
473
|
use warnings; |
|
95
|
|
|
|
|
188
|
|
|
95
|
|
|
|
|
2495
|
|
4
|
|
|
|
|
|
|
|
5
|
95
|
|
|
95
|
|
446
|
use Carp qw/confess croak/; |
|
95
|
|
|
|
|
190
|
|
|
95
|
|
|
|
|
4715
|
|
6
|
95
|
|
|
95
|
|
484
|
use Scalar::Util qw/blessed/; |
|
95
|
|
|
|
|
182
|
|
|
95
|
|
|
|
|
4020
|
|
7
|
|
|
|
|
|
|
|
8
|
95
|
|
|
95
|
|
54931
|
use Test::Stream::Workflow::Unit; |
|
95
|
|
|
|
|
263
|
|
|
95
|
|
|
|
|
3261
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
use Test::Stream::HashBase( |
11
|
95
|
|
|
|
|
594
|
accessors => [qw/unit runner runner_args autorun/], |
12
|
95
|
|
|
95
|
|
683
|
); |
|
95
|
|
|
|
|
190
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
my %METAS; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub init { |
17
|
34
|
|
|
34
|
0
|
72
|
my $self = shift; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
confess "unit is a required attribute" |
20
|
34
|
50
|
|
|
|
233
|
unless $self->{+UNIT}; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub build { |
24
|
35
|
|
|
35
|
1
|
96
|
my $class = shift; |
25
|
35
|
|
|
|
|
104
|
my ($pkg, $file, $start_line, $end_line) = @_; |
26
|
|
|
|
|
|
|
|
27
|
35
|
100
|
|
|
|
202
|
return $METAS{$pkg} if $METAS{$pkg}; |
28
|
|
|
|
|
|
|
|
29
|
34
|
|
|
|
|
304
|
my $unit = Test::Stream::Workflow::Unit->new( |
30
|
|
|
|
|
|
|
name => $pkg, |
31
|
|
|
|
|
|
|
package => $pkg, |
32
|
|
|
|
|
|
|
file => $file, |
33
|
|
|
|
|
|
|
start_line => $start_line, |
34
|
|
|
|
|
|
|
end_line => $end_line, |
35
|
|
|
|
|
|
|
type => 'group', |
36
|
|
|
|
|
|
|
is_root => 1, |
37
|
|
|
|
|
|
|
); |
38
|
|
|
|
|
|
|
|
39
|
34
|
|
|
|
|
176
|
my $meta = $class->new( |
40
|
|
|
|
|
|
|
UNIT() => $unit, |
41
|
|
|
|
|
|
|
AUTORUN() => 1, |
42
|
|
|
|
|
|
|
); |
43
|
|
|
|
|
|
|
|
44
|
34
|
|
|
|
|
107
|
$METAS{$pkg} = $meta; |
45
|
|
|
|
|
|
|
|
46
|
34
|
|
|
|
|
235
|
my $hub = Test::Stream::Sync->stack->top; |
47
|
|
|
|
|
|
|
$hub->follow_up( |
48
|
|
|
|
|
|
|
sub { |
49
|
34
|
100
|
|
34
|
|
202
|
return unless $METAS{$pkg}; |
50
|
30
|
100
|
|
|
|
171
|
return unless $METAS{$pkg}->autorun; |
51
|
25
|
|
|
|
|
210
|
$METAS{$pkg}->run; |
52
|
|
|
|
|
|
|
# Make sure the build cannot be found after done_testing |
53
|
24
|
|
|
|
|
2427
|
delete $METAS{$pkg}->{+UNIT}; |
54
|
|
|
|
|
|
|
} |
55
|
34
|
|
|
|
|
395
|
); |
56
|
|
|
|
|
|
|
|
57
|
34
|
|
|
|
|
504
|
return $meta; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub purge { |
61
|
6
|
|
|
6
|
1
|
17
|
my $it = shift; |
62
|
6
|
|
|
|
|
10
|
my $pkg = $_[0]; |
63
|
|
|
|
|
|
|
|
64
|
6
|
100
|
33
|
|
|
58
|
$pkg ||= $it->{+UNIT}->package if blessed($it) && $it->{+UNIT}; |
|
|
|
66
|
|
|
|
|
65
|
|
|
|
|
|
|
|
66
|
6
|
100
|
|
|
|
298
|
croak "You must specify a package to purge" |
67
|
|
|
|
|
|
|
unless $pkg; |
68
|
|
|
|
|
|
|
|
69
|
4
|
|
|
|
|
11
|
delete $METAS{$pkg}; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub get { |
73
|
256
|
|
|
256
|
1
|
445
|
my $class = shift; |
74
|
256
|
|
|
|
|
390
|
my ($pkg) = @_; |
75
|
256
|
|
|
|
|
1399
|
return $METAS{$pkg}; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub run { |
79
|
26
|
|
|
26
|
1
|
60
|
my $self = shift; |
80
|
26
|
|
|
|
|
144
|
my $runner = $self->runner; |
81
|
26
|
50
|
|
|
|
161
|
unless ($runner) { |
82
|
26
|
|
|
|
|
19026
|
require Test::Stream::Workflow::Runner; |
83
|
26
|
|
|
|
|
103
|
$runner = 'Test::Stream::Workflow::Runner'; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
26
|
|
|
|
|
158
|
$self->unit->do_post; |
87
|
|
|
|
|
|
|
|
88
|
26
|
|
50
|
|
|
128
|
$runner->run( |
89
|
|
|
|
|
|
|
unit => $self->unit, |
90
|
|
|
|
|
|
|
args => $self->runner_args || [], |
91
|
|
|
|
|
|
|
no_final => 1 |
92
|
|
|
|
|
|
|
); |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
1; |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
__END__ |