line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Stream::Workflow::Runner; |
2
|
28
|
|
|
28
|
|
1309
|
use strict; |
|
28
|
|
|
|
|
57
|
|
|
28
|
|
|
|
|
807
|
|
3
|
28
|
|
|
28
|
|
140
|
use warnings; |
|
28
|
|
|
|
|
53
|
|
|
28
|
|
|
|
|
988
|
|
4
|
|
|
|
|
|
|
|
5
|
28
|
|
|
28
|
|
161
|
use Test::Stream::Util qw/try/; |
|
28
|
|
|
|
|
51
|
|
|
28
|
|
|
|
|
247
|
|
6
|
|
|
|
|
|
|
|
7
|
28
|
|
|
28
|
|
17189
|
use Test::Stream::Workflow::Task; |
|
28
|
|
|
|
|
74
|
|
|
28
|
|
|
|
|
767
|
|
8
|
28
|
|
|
28
|
|
183
|
use Test::Stream::Sync; |
|
28
|
|
|
|
|
54
|
|
|
28
|
|
|
|
|
12723
|
|
9
|
|
|
|
|
|
|
|
10
|
315
|
|
|
315
|
1
|
1949
|
sub subtests { 1 } |
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
1
|
6
|
sub instance { shift } |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub import { |
15
|
3
|
|
|
3
|
|
14
|
my $class = shift; |
16
|
3
|
|
|
|
|
8
|
my $caller = caller; |
17
|
|
|
|
|
|
|
|
18
|
3
|
|
|
|
|
17
|
require Test::Stream::Workflow::Meta; |
19
|
3
|
100
|
|
|
|
20
|
my $meta = Test::Stream::Workflow::Meta->get($caller) or return; |
20
|
1
|
|
|
|
|
6
|
$meta->set_runner($class->instance(@_)); |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
my %SUPPORTED = map {$_ => 1} qw/todo skip/; |
24
|
|
|
|
|
|
|
sub verify_meta { |
25
|
318
|
|
|
318
|
1
|
531
|
my $class = shift; |
26
|
318
|
|
|
|
|
519
|
my ($unit) = @_; |
27
|
318
|
50
|
|
|
|
1308
|
my $meta = $unit->meta or return; |
28
|
318
|
|
|
|
|
2650
|
my $ctx = $unit->context; |
29
|
318
|
|
|
|
|
1740
|
for my $k (keys %$meta) { |
30
|
10
|
100
|
|
|
|
46
|
next if $SUPPORTED{$k}; |
31
|
1
|
|
|
|
|
7
|
$ctx->alert("'$k' is not a recognised meta-key"); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub run { |
36
|
314
|
|
|
314
|
1
|
3441
|
my $class = shift; |
37
|
314
|
|
|
|
|
1102
|
my %params = @_; |
38
|
314
|
|
|
|
|
588
|
my $unit = $params{unit}; |
39
|
314
|
|
|
|
|
579
|
my $args = $params{args}; |
40
|
314
|
|
|
|
|
510
|
my $no_final = $params{no_final}; |
41
|
|
|
|
|
|
|
|
42
|
314
|
|
|
|
|
1055
|
$class->verify_meta($unit); |
43
|
|
|
|
|
|
|
|
44
|
314
|
|
|
|
|
1221
|
my $task = Test::Stream::Workflow::Task->new( |
45
|
|
|
|
|
|
|
unit => $unit, |
46
|
|
|
|
|
|
|
args => $args, |
47
|
|
|
|
|
|
|
runner => $class, |
48
|
|
|
|
|
|
|
no_final => $no_final, |
49
|
|
|
|
|
|
|
no_subtest => !$class->subtests($unit), |
50
|
|
|
|
|
|
|
); |
51
|
|
|
|
|
|
|
|
52
|
314
|
|
|
238
|
|
2098
|
my ($ok, $err) = try { $class->run_task($task) }; |
|
314
|
|
|
|
|
1120
|
|
53
|
312
|
|
|
|
|
2864
|
Test::Stream::Sync->stack->top->cull(); |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
# Report exceptions |
56
|
312
|
100
|
|
|
|
1069
|
unless($ok) { |
57
|
2
|
|
|
|
|
9
|
my $ctx = $unit->context; |
58
|
2
|
|
|
|
|
9
|
$ctx->ok(0, $unit->name, ["Caught Exception: $err"]); |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
312
|
|
|
|
|
3425
|
return; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub run_task { |
65
|
313
|
|
|
313
|
1
|
517
|
my $class = shift; |
66
|
313
|
|
|
|
|
545
|
my ($task) = @_; |
67
|
|
|
|
|
|
|
|
68
|
313
|
|
|
|
|
1262
|
return $task->run(); |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
1; |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
__END__ |