line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Some; |
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:YANICK'; |
3
|
|
|
|
|
|
|
# ABSTRACT: test a subset of tests |
4
|
|
|
|
|
|
|
$Test::Some::VERSION = '0.1.0'; |
5
|
|
|
|
|
|
|
|
6
|
8
|
|
|
8
|
|
29082
|
use 5.10.0; |
|
8
|
|
|
|
|
29
|
|
7
|
|
|
|
|
|
|
|
8
|
8
|
|
|
8
|
|
70
|
use strict; |
|
8
|
|
|
|
|
12
|
|
|
8
|
|
|
|
|
177
|
|
9
|
8
|
|
|
8
|
|
40
|
use warnings; |
|
8
|
|
|
|
|
13
|
|
|
8
|
|
|
|
|
211
|
|
10
|
|
|
|
|
|
|
|
11
|
8
|
|
|
8
|
|
7600
|
use Test::More; |
|
8
|
|
|
|
|
133914
|
|
|
8
|
|
|
|
|
67
|
|
12
|
|
|
|
|
|
|
|
13
|
8
|
|
|
8
|
|
9320
|
use List::MoreUtils qw/ none any /; |
|
8
|
|
|
|
|
98865
|
|
|
8
|
|
|
|
|
60
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our %filters; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
our $BYPASS = 0; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub import { |
20
|
8
|
|
|
8
|
|
79
|
my $caller = caller; |
21
|
8
|
|
|
|
|
25
|
my(undef,@filters) = @_; |
22
|
|
|
|
|
|
|
|
23
|
8
|
|
|
8
|
|
6292
|
no warnings 'uninitialized'; |
|
8
|
|
|
|
|
17
|
|
|
8
|
|
|
|
|
4783
|
|
24
|
8
|
100
|
|
|
|
46
|
@filters = split ',', $ENV{TEST_SOME} unless @filters; |
25
|
|
|
|
|
|
|
|
26
|
8
|
|
|
|
|
32
|
_groom_filter($caller,$_) for @filters; |
27
|
|
|
|
|
|
|
|
28
|
8
|
|
|
8
|
|
45
|
eval <<"END_EVAL"; |
|
8
|
|
|
8
|
|
14
|
|
|
8
|
|
|
8
|
|
58
|
|
|
8
|
|
|
|
|
8828
|
|
|
8
|
|
|
|
|
12722
|
|
|
8
|
|
|
|
|
812
|
|
|
8
|
|
|
|
|
74
|
|
|
26
|
|
|
|
|
26779
|
|
|
8
|
|
|
|
|
559
|
|
29
|
|
|
|
|
|
|
package $caller; |
30
|
|
|
|
|
|
|
use Test::More; |
31
|
|
|
|
|
|
|
use Class::Method::Modifiers; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
# needs to be after Test::More put |
34
|
|
|
|
|
|
|
# its own 'subtest' in there, |
35
|
|
|
|
|
|
|
# hence the INIT |
36
|
|
|
|
|
|
|
INIT { |
37
|
|
|
|
|
|
|
around subtest => sub { |
38
|
|
|
|
|
|
|
Test::Some::_subtest(\@_); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
END_EVAL |
42
|
|
|
|
|
|
|
|
43
|
8
|
50
|
|
|
|
1790
|
die $@ if $@; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub _groom_filter { |
48
|
32
|
|
|
32
|
|
125
|
my( $caller, $filter, $is_tag, $is_negated ) = @_; |
49
|
|
|
|
|
|
|
|
50
|
32
|
100
|
|
|
|
89
|
if( $filter eq '~' ) { |
51
|
3
|
|
|
|
|
4
|
$BYPASS = 1; |
52
|
3
|
|
|
|
|
12
|
return; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
29
|
100
|
|
|
|
100
|
return _groom_filter( $caller, $filter, 1, $is_negated ) |
56
|
|
|
|
|
|
|
if $filter =~ s/^://; |
57
|
|
|
|
|
|
|
|
58
|
24
|
100
|
|
|
|
70
|
return _groom_filter( $caller, $filter, $is_tag, 1 ) |
59
|
|
|
|
|
|
|
if $filter =~ s/^!//; |
60
|
|
|
|
|
|
|
|
61
|
22
|
100
|
|
|
|
137
|
return _groom_filter( $caller, qr/$filter/, $is_tag, $is_negated ) |
62
|
|
|
|
|
|
|
if $filter =~ s#^/##; |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
my $sub = ref $filter eq 'CODE' ? $filter |
65
|
|
|
|
|
|
|
: $is_tag ? sub { |
66
|
13
|
100
|
|
13
|
|
71
|
if ( ref $filter ) { |
67
|
7
|
|
|
|
|
19
|
for my $key ( keys %_ ) { |
68
|
3
|
50
|
|
|
|
31
|
return 1 if $key =~ $filter; |
69
|
|
|
|
|
|
|
} |
70
|
4
|
|
|
|
|
23
|
return 0; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
6
|
|
|
|
|
26
|
return $_{$filter}; |
74
|
|
|
|
|
|
|
} |
75
|
15
|
100
|
|
30
|
|
94
|
: sub { ref $filter ? /$filter/ : $_ eq $filter }; |
|
30
|
100
|
|
|
|
241
|
|
|
|
100
|
|
|
|
|
|
76
|
|
|
|
|
|
|
|
77
|
15
|
100
|
|
|
|
45
|
if( $is_negated ) { |
78
|
2
|
|
|
|
|
3
|
my $prev_sub = $sub; |
79
|
2
|
|
|
5
|
|
8
|
$sub = sub { not $prev_sub->() }; |
|
5
|
|
|
|
|
28
|
|
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
15
|
|
|
|
|
21
|
push @{ $filters{$caller} }, $sub; |
|
15
|
|
|
|
|
74
|
|
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
sub _should_be_skipped { |
86
|
26
|
|
|
26
|
|
45
|
my( $caller, $name, @tags ) = @_; |
87
|
|
|
|
|
|
|
|
88
|
26
|
|
|
|
|
44
|
for my $filter ( eval { @{ $filters{$caller} } } ) { |
|
26
|
|
|
|
|
35
|
|
|
26
|
|
|
|
|
90
|
|
89
|
46
|
|
|
|
|
70
|
local $_ = $name; |
90
|
46
|
|
|
|
|
107
|
local %_ = map { $_ => 1 } @tags; |
|
21
|
|
|
|
|
60
|
|
91
|
46
|
100
|
|
|
|
101
|
return if $filter->(); |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
7
|
|
|
|
|
49
|
return 1; |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
sub _subtest { |
98
|
26
|
|
|
26
|
|
70
|
my( $orig, $name, $code, @tags ) = @_; |
99
|
26
|
|
|
|
|
54
|
my $caller = caller 3; |
100
|
|
|
|
|
|
|
|
101
|
26
|
100
|
|
|
|
69
|
if( _should_be_skipped($caller,$name,@tags) ) { |
102
|
7
|
100
|
|
|
|
136
|
return if $BYPASS; |
103
|
|
|
|
|
|
|
$code = sub { |
104
|
4
|
|
|
4
|
|
1729
|
Test::More::plan( skip_all => 'Test::Some skipping' ); |
105
|
|
|
|
|
|
|
$orig->($name, sub { } ) |
106
|
0
|
|
|
|
|
0
|
} |
107
|
4
|
|
|
|
|
19
|
} |
108
|
|
|
|
|
|
|
|
109
|
23
|
|
|
|
|
117
|
$orig->( $name, $code ); |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
1; |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
__END__ |