line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Text::TestBase::SubTest::Node::SubTest; |
2
|
17
|
|
|
17
|
|
1312
|
use parent qw(Text::TestBase::SubTest::Node); |
|
17
|
|
|
|
|
32
|
|
|
17
|
|
|
|
|
127
|
|
3
|
17
|
|
|
17
|
|
1265
|
use Carp qw(croak); |
|
17
|
|
|
|
|
26
|
|
|
17
|
|
|
|
|
922
|
|
4
|
17
|
|
|
17
|
|
97
|
use Scalar::Util qw(weaken); |
|
17
|
|
|
|
|
61
|
|
|
17
|
|
|
|
|
4173
|
|
5
|
|
|
|
|
|
|
use Class::Accessor::Lite ( |
6
|
17
|
|
|
|
|
141
|
rw => [qw/name/], |
7
|
17
|
|
|
17
|
|
259
|
); |
|
17
|
|
|
|
|
30
|
|
8
|
|
|
|
|
|
|
sub new { |
9
|
58
|
|
|
58
|
0
|
209
|
my ($class, %args) = @_; |
10
|
58
|
|
|
|
|
471
|
bless +{ |
11
|
|
|
|
|
|
|
%args, |
12
|
|
|
|
|
|
|
child_nodes => [], |
13
|
|
|
|
|
|
|
}, $class; |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
2
|
|
|
2
|
0
|
56
|
sub get_lineno { return $_[0]->{_lineno} } |
17
|
|
|
|
|
|
|
|
18
|
210
|
|
|
210
|
0
|
458
|
sub is_subtest { 1 } |
19
|
1
|
|
|
1
|
0
|
823
|
sub is_block { 0 } |
20
|
3
|
|
|
3
|
0
|
15
|
sub is_root { 0 } |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub child_nodes { # ro |
23
|
237
|
|
|
237
|
0
|
1409
|
my ($self, $i) = @_; |
24
|
237
|
100
|
|
|
|
1047
|
return $self->{child_nodes} unless defined $i; |
25
|
4
|
|
|
|
|
22
|
return $self->{child_nodes}->[$i]; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub child_blocks { # ro |
29
|
16
|
|
|
16
|
0
|
6288
|
my ($self, $i) = @_; |
30
|
16
|
|
|
|
|
27
|
my @nodes = grep { ! $_->is_subtest } @{ $self->child_nodes }; |
|
23
|
|
|
|
|
75
|
|
|
16
|
|
|
|
|
35
|
|
31
|
16
|
100
|
|
|
|
61
|
return \@nodes unless defined $i; |
32
|
11
|
|
|
|
|
67
|
return $nodes[$i]; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub child_subtests { # ro |
36
|
130
|
|
|
130
|
0
|
17949
|
my ($self, $i) = @_; |
37
|
130
|
|
|
|
|
160
|
my @nodes = grep { $_->is_subtest } @{ $self->child_nodes }; |
|
199
|
|
|
|
|
343
|
|
|
130
|
|
|
|
|
294
|
|
38
|
130
|
100
|
|
|
|
974
|
return \@nodes unless defined $i; |
39
|
81
|
|
|
|
|
317
|
return $nodes[$i]; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
3
|
|
|
3
|
0
|
6
|
sub has_child_nodes { scalar(@{ $_[0]->child_nodes }) > 0 } |
|
3
|
|
|
|
|
9
|
|
43
|
3
|
|
|
3
|
0
|
5
|
sub has_child_blocks { scalar(@{ $_[0]->child_blocks }) > 0 } |
|
3
|
|
|
|
|
34
|
|
44
|
3
|
|
|
3
|
0
|
6
|
sub has_child_subtests { scalar(@{ $_[0]->child_subtests }) > 0 } |
|
3
|
|
|
|
|
9
|
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub append_child { |
47
|
68
|
|
|
68
|
0
|
144
|
my ($self, $child) = @_; |
48
|
68
|
50
|
|
|
|
200
|
croak '$self->depth is required' unless defined $self->depth; |
49
|
68
|
|
|
|
|
494
|
my $child_nodes = $self->child_nodes; |
50
|
|
|
|
|
|
|
|
51
|
68
|
|
|
|
|
310
|
$child->parent_node($self); |
52
|
68
|
|
|
|
|
557
|
$child->index(scalar @$child_nodes); |
53
|
68
|
|
|
|
|
479
|
$child->depth($self->depth + 1); |
54
|
|
|
|
|
|
|
|
55
|
68
|
|
|
|
|
580
|
push @$child_nodes, $child; |
56
|
68
|
|
|
|
|
321
|
weaken $child->{parent_node}; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
1; |