| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
9
|
|
|
9
|
|
4114
|
use 5.008001; |
|
|
9
|
|
|
|
|
82
|
|
|
2
|
9
|
|
|
9
|
|
4403
|
use strictures; |
|
|
9
|
|
|
|
|
15131
|
|
|
|
9
|
|
|
|
|
59
|
|
|
3
|
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package Test2::Roo; |
|
5
|
|
|
|
|
|
|
# ABSTRACT: Composable, reusable tests with roles and Moo |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '1.005'; |
|
8
|
|
|
|
|
|
|
|
|
9
|
9
|
|
|
9
|
|
7379
|
use Test2::API qw( context run_subtest ); |
|
|
9
|
|
|
|
|
643807
|
|
|
|
9
|
|
|
|
|
832
|
|
|
10
|
9
|
|
|
9
|
|
4163
|
use Sub::Install; |
|
|
9
|
|
|
|
|
15731
|
|
|
|
9
|
|
|
|
|
41
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub import { |
|
13
|
9
|
|
|
9
|
|
94
|
my ( $class, @args ) = @_; |
|
14
|
9
|
|
|
|
|
22
|
my $caller = caller; |
|
15
|
9
|
|
|
|
|
23
|
for my $sub (qw/test top_test run_me/) { |
|
16
|
27
|
|
|
|
|
1208
|
Sub::Install::install_sub( { into => $caller, code => $sub } ); |
|
17
|
|
|
|
|
|
|
} |
|
18
|
9
|
|
|
|
|
468
|
strictures->import; # do this for Moo, since we load Moo in eval |
|
19
|
9
|
|
|
9
|
|
5029
|
eval qq{ |
|
|
9
|
|
|
|
|
104028
|
|
|
|
9
|
|
|
|
|
47
|
|
|
|
9
|
|
|
|
|
2376
|
|
|
20
|
|
|
|
|
|
|
package $caller; |
|
21
|
|
|
|
|
|
|
use Moo; |
|
22
|
|
|
|
|
|
|
extends 'Test2::Roo::Class' |
|
23
|
|
|
|
|
|
|
}; |
|
24
|
9
|
50
|
|
|
|
764
|
die $@ if $@; |
|
25
|
9
|
100
|
|
|
|
44
|
if (@args) { |
|
26
|
1
|
|
|
1
|
|
73
|
eval qq{ package $caller; use Test2::V0 \@args }; |
|
|
1
|
|
|
|
|
527
|
|
|
|
1
|
|
|
|
|
153765
|
|
|
|
1
|
|
|
|
|
10
|
|
|
27
|
|
|
|
|
|
|
} |
|
28
|
|
|
|
|
|
|
else { |
|
29
|
8
|
|
|
8
|
|
4241
|
eval qq{ package $caller; use Test2::V0 }; |
|
|
8
|
|
|
|
|
1242450
|
|
|
|
8
|
|
|
|
|
70
|
|
|
|
8
|
|
|
|
|
635
|
|
|
30
|
|
|
|
|
|
|
} |
|
31
|
9
|
50
|
|
|
|
15155
|
die $@ if $@; |
|
32
|
|
|
|
|
|
|
} |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub test { |
|
35
|
10
|
|
|
10
|
1
|
60853
|
my ( $name, $code ) = @_; |
|
36
|
10
|
|
|
|
|
31
|
my $caller = caller; |
|
37
|
|
|
|
|
|
|
my $subtest = sub { |
|
38
|
13
|
|
|
13
|
|
145
|
my $self = shift; |
|
39
|
13
|
|
|
|
|
46
|
my $ctx = context(); |
|
40
|
13
|
|
|
|
|
953
|
my $pass = run_subtest( $name, sub { $self->each_test($code) }, { buffered => 1, inherit_trace => 1 } ); |
|
|
13
|
|
|
|
|
4122
|
|
|
41
|
13
|
|
|
|
|
76299
|
$ctx->release; |
|
42
|
13
|
|
|
|
|
123
|
return $pass; |
|
43
|
10
|
|
|
|
|
49
|
}; |
|
44
|
10
|
|
|
|
|
655
|
eval qq{ package $caller; after _do_tests => \$subtest }; |
|
45
|
10
|
50
|
|
|
|
10207
|
die $@ if $@; |
|
46
|
|
|
|
|
|
|
} |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub top_test { |
|
49
|
1
|
|
|
1
|
1
|
1126
|
my ( $name, $code ) = @_; |
|
50
|
1
|
|
|
|
|
3
|
my $caller = caller; |
|
51
|
1
|
|
|
1
|
|
5
|
my $test = sub { shift->each_test($code) }; |
|
|
1
|
|
|
|
|
10
|
|
|
52
|
1
|
|
|
|
|
65
|
eval qq{ package $caller; after _do_tests => \$test }; |
|
53
|
1
|
50
|
|
|
|
2449
|
die $@ if $@; |
|
54
|
|
|
|
|
|
|
} |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub run_me { |
|
57
|
6
|
|
|
6
|
1
|
4664
|
my $class = caller; |
|
58
|
6
|
|
|
|
|
64
|
$class->run_tests(@_); |
|
59
|
|
|
|
|
|
|
} |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
1; |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
# vim: ts=4 sts=4 sw=4 et: |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
__END__ |