line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Stream::Workflow::Meta; |
2
|
95
|
|
|
95
|
|
632
|
use strict; |
|
95
|
|
|
|
|
109
|
|
|
95
|
|
|
|
|
2085
|
|
3
|
95
|
|
|
95
|
|
277
|
use warnings; |
|
95
|
|
|
|
|
110
|
|
|
95
|
|
|
|
|
1857
|
|
4
|
|
|
|
|
|
|
|
5
|
95
|
|
|
95
|
|
288
|
use Carp qw/confess croak/; |
|
95
|
|
|
|
|
99
|
|
|
95
|
|
|
|
|
3669
|
|
6
|
95
|
|
|
95
|
|
325
|
use Scalar::Util qw/blessed/; |
|
95
|
|
|
|
|
109
|
|
|
95
|
|
|
|
|
2904
|
|
7
|
|
|
|
|
|
|
|
8
|
95
|
|
|
95
|
|
32743
|
use Test::Stream::Workflow::Unit(); |
|
95
|
|
|
|
|
176
|
|
|
95
|
|
|
|
|
2116
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
use Test::Stream::HashBase( |
11
|
95
|
|
|
|
|
415
|
accessors => [qw/unit runner runner_args autorun/], |
12
|
95
|
|
|
95
|
|
417
|
); |
|
95
|
|
|
|
|
107
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
my %METAS; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub init { |
17
|
34
|
|
|
34
|
0
|
51
|
my $self = shift; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
confess "unit is a required attribute" |
20
|
34
|
50
|
|
|
|
282
|
unless $self->{+UNIT}; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub build { |
24
|
35
|
|
|
35
|
1
|
58
|
my $class = shift; |
25
|
35
|
|
|
|
|
70
|
my ($pkg, $file, $start_line, $end_line) = @_; |
26
|
|
|
|
|
|
|
|
27
|
35
|
100
|
|
|
|
104
|
return $METAS{$pkg} if $METAS{$pkg}; |
28
|
|
|
|
|
|
|
|
29
|
34
|
|
|
|
|
203
|
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
|
|
|
|
|
126
|
my $meta = $class->new( |
40
|
|
|
|
|
|
|
UNIT() => $unit, |
41
|
|
|
|
|
|
|
AUTORUN() => 1, |
42
|
|
|
|
|
|
|
); |
43
|
|
|
|
|
|
|
|
44
|
34
|
|
|
|
|
62
|
$METAS{$pkg} = $meta; |
45
|
|
|
|
|
|
|
|
46
|
34
|
|
|
|
|
168
|
my $hub = Test::Stream::Sync->stack->top; |
47
|
|
|
|
|
|
|
$hub->follow_up( |
48
|
|
|
|
|
|
|
sub { |
49
|
34
|
100
|
|
34
|
|
119
|
return unless $METAS{$pkg}; |
50
|
30
|
100
|
|
|
|
156
|
return unless $METAS{$pkg}->autorun; |
51
|
25
|
|
|
|
|
154
|
$METAS{$pkg}->run; |
52
|
|
|
|
|
|
|
# Make sure the build cannot be found after done_testing |
53
|
24
|
|
|
|
|
1690
|
delete $METAS{$pkg}->{+UNIT}; |
54
|
|
|
|
|
|
|
} |
55
|
34
|
|
|
|
|
252
|
); |
56
|
|
|
|
|
|
|
|
57
|
34
|
|
|
|
|
78
|
return $meta; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub purge { |
61
|
6
|
|
|
6
|
1
|
11
|
my $it = shift; |
62
|
6
|
|
|
|
|
7
|
my $pkg = $_[0]; |
63
|
|
|
|
|
|
|
|
64
|
6
|
100
|
33
|
|
|
46
|
$pkg ||= $it->{+UNIT}->package if blessed($it) && $it->{+UNIT}; |
|
|
|
66
|
|
|
|
|
65
|
|
|
|
|
|
|
|
66
|
6
|
100
|
|
|
|
246
|
croak "You must specify a package to purge" |
67
|
|
|
|
|
|
|
unless $pkg; |
68
|
|
|
|
|
|
|
|
69
|
4
|
|
|
|
|
8
|
delete $METAS{$pkg}; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub get { |
73
|
258
|
|
|
258
|
1
|
299
|
my $class = shift; |
74
|
258
|
|
|
|
|
225
|
my ($pkg) = @_; |
75
|
258
|
|
|
|
|
1031
|
return $METAS{$pkg}; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub run { |
79
|
26
|
|
|
26
|
1
|
43
|
my $self = shift; |
80
|
26
|
|
|
|
|
95
|
my $runner = $self->runner; |
81
|
26
|
50
|
|
|
|
119
|
unless ($runner) { |
82
|
26
|
|
|
|
|
11758
|
require Test::Stream::Workflow::Runner; |
83
|
26
|
|
|
|
|
72
|
$runner = 'Test::Stream::Workflow::Runner'; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
26
|
|
|
|
|
116
|
$self->unit->do_post; |
87
|
|
|
|
|
|
|
|
88
|
26
|
|
50
|
|
|
97
|
$runner->run( |
89
|
|
|
|
|
|
|
unit => $self->unit, |
90
|
|
|
|
|
|
|
args => $self->runner_args || [], |
91
|
|
|
|
|
|
|
no_final => 1 |
92
|
|
|
|
|
|
|
); |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
1; |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
__END__ |