line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#<<< |
2
|
6
|
|
|
6
|
|
2995
|
use strict; use warnings; |
|
6
|
|
|
6
|
|
39
|
|
|
6
|
|
|
|
|
155
|
|
|
6
|
|
|
|
|
40
|
|
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
466
|
|
3
|
|
|
|
|
|
|
#>>> |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Test::Builder::SubtestSelection; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.001002'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
BEGIN { |
10
|
6
|
|
|
6
|
|
2742
|
require parent; |
11
|
6
|
|
|
|
|
2057
|
local $ENV{ TB_NO_EARLY_INIT } = 1; |
12
|
6
|
|
|
|
|
33
|
parent->import( qw( Test::Builder ) ); |
13
|
|
|
|
|
|
|
} |
14
|
6
|
|
|
6
|
|
365995
|
use Getopt::Long qw( GetOptions :config posix_default ); |
|
6
|
|
|
|
|
77889
|
|
|
6
|
|
|
|
|
43
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
my @subtest_selection; |
17
|
|
|
|
|
|
|
# parse @ARGV |
18
|
|
|
|
|
|
|
GetOptions( |
19
|
|
|
|
|
|
|
's|subtest=s' => sub { |
20
|
|
|
|
|
|
|
( undef, my $opt_value ) = @_; |
21
|
|
|
|
|
|
|
push @subtest_selection, eval { qr/$opt_value/ } ? $opt_value : "\Q$opt_value\E"; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
); |
24
|
|
|
|
|
|
|
|
25
|
6
|
|
|
6
|
|
101
|
sub import { shift->new; } |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# override Test::Builder::subtest() |
28
|
|
|
|
|
|
|
sub subtest { |
29
|
13
|
|
|
13
|
1
|
31813
|
my ( $self, $name ) = @_; |
30
|
|
|
|
|
|
|
|
31
|
13
|
|
|
|
|
36
|
my $class = ref $self; |
32
|
13
|
|
|
|
|
44
|
my $current_test = $self->current_test + 1; |
33
|
13
|
100
|
100
|
|
|
1527
|
if ( |
|
|
|
100
|
|
|
|
|
34
|
|
|
|
|
|
|
defined $self->parent # ignore nested subtests |
35
|
|
|
|
|
|
|
or not @subtest_selection |
36
|
12
|
100
|
|
|
|
1481
|
or grep { m/\A [1-9]\d* \z/x ? $current_test == $_ : $name =~ m/$_/ } @subtest_selection |
37
|
|
|
|
|
|
|
) |
38
|
|
|
|
|
|
|
{ |
39
|
9
|
|
|
|
|
520
|
goto $class->can( 'SUPER::subtest' ); |
40
|
|
|
|
|
|
|
} else { |
41
|
4
|
|
|
|
|
48
|
$self->skip( "forced by $class", $name ); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
1; |