line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Stream::Workflow::Meta; |
2
|
95
|
|
|
95
|
|
1016
|
use strict; |
|
95
|
|
|
|
|
189
|
|
|
95
|
|
|
|
|
2314
|
|
3
|
95
|
|
|
95
|
|
475
|
use warnings; |
|
95
|
|
|
|
|
193
|
|
|
95
|
|
|
|
|
2637
|
|
4
|
|
|
|
|
|
|
|
5
|
95
|
|
|
95
|
|
472
|
use Carp qw/confess croak/; |
|
95
|
|
|
|
|
179
|
|
|
95
|
|
|
|
|
4727
|
|
6
|
95
|
|
|
95
|
|
497
|
use Scalar::Util qw/blessed/; |
|
95
|
|
|
|
|
196
|
|
|
95
|
|
|
|
|
4127
|
|
7
|
|
|
|
|
|
|
|
8
|
95
|
|
|
95
|
|
54609
|
use Test::Stream::Workflow::Unit; |
|
95
|
|
|
|
|
258
|
|
|
95
|
|
|
|
|
3306
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
use Test::Stream::HashBase( |
11
|
95
|
|
|
|
|
637
|
accessors => [qw/unit runner runner_args autorun/], |
12
|
95
|
|
|
95
|
|
542
|
); |
|
95
|
|
|
|
|
198
|
|
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
|
|
|
|
237
|
unless $self->{+UNIT}; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub build { |
24
|
35
|
|
|
35
|
1
|
91
|
my $class = shift; |
25
|
35
|
|
|
|
|
104
|
my ($pkg, $file, $start_line, $end_line) = @_; |
26
|
|
|
|
|
|
|
|
27
|
35
|
100
|
|
|
|
157
|
return $METAS{$pkg} if $METAS{$pkg}; |
28
|
|
|
|
|
|
|
|
29
|
34
|
|
|
|
|
306
|
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
|
|
|
|
|
171
|
my $meta = $class->new( |
40
|
|
|
|
|
|
|
UNIT() => $unit, |
41
|
|
|
|
|
|
|
AUTORUN() => 1, |
42
|
|
|
|
|
|
|
); |
43
|
|
|
|
|
|
|
|
44
|
34
|
|
|
|
|
110
|
$METAS{$pkg} = $meta; |
45
|
|
|
|
|
|
|
|
46
|
34
|
|
|
|
|
281
|
my $hub = Test::Stream::Sync->stack->top; |
47
|
|
|
|
|
|
|
$hub->follow_up( |
48
|
|
|
|
|
|
|
sub { |
49
|
34
|
100
|
|
34
|
|
211
|
return unless $METAS{$pkg}; |
50
|
30
|
100
|
|
|
|
198
|
return unless $METAS{$pkg}->autorun; |
51
|
25
|
|
|
|
|
232
|
$METAS{$pkg}->run; |
52
|
|
|
|
|
|
|
# Make sure the build cannot be found after done_testing |
53
|
24
|
|
|
|
|
2250
|
delete $METAS{$pkg}->{+UNIT}; |
54
|
|
|
|
|
|
|
} |
55
|
34
|
|
|
|
|
336
|
); |
56
|
|
|
|
|
|
|
|
57
|
34
|
|
|
|
|
533
|
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
|
|
|
48
|
$pkg ||= $it->{+UNIT}->package if blessed($it) && $it->{+UNIT}; |
|
|
|
66
|
|
|
|
|
65
|
|
|
|
|
|
|
|
66
|
6
|
100
|
|
|
|
331
|
croak "You must specify a package to purge" |
67
|
|
|
|
|
|
|
unless $pkg; |
68
|
|
|
|
|
|
|
|
69
|
4
|
|
|
|
|
12
|
delete $METAS{$pkg}; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub get { |
73
|
256
|
|
|
256
|
1
|
436
|
my $class = shift; |
74
|
256
|
|
|
|
|
437
|
my ($pkg) = @_; |
75
|
256
|
|
|
|
|
1396
|
return $METAS{$pkg}; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub run { |
79
|
26
|
|
|
26
|
1
|
81
|
my $self = shift; |
80
|
26
|
|
|
|
|
150
|
my $runner = $self->runner; |
81
|
26
|
50
|
|
|
|
181
|
unless ($runner) { |
82
|
26
|
|
|
|
|
18817
|
require Test::Stream::Workflow::Runner; |
83
|
26
|
|
|
|
|
97
|
$runner = 'Test::Stream::Workflow::Runner'; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
26
|
|
|
|
|
157
|
$self->unit->do_post; |
87
|
|
|
|
|
|
|
|
88
|
26
|
|
50
|
|
|
123
|
$runner->run( |
89
|
|
|
|
|
|
|
unit => $self->unit, |
90
|
|
|
|
|
|
|
args => $self->runner_args || [], |
91
|
|
|
|
|
|
|
no_final => 1 |
92
|
|
|
|
|
|
|
); |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
1; |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
__END__ |