line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package TAP::Tree::Iterator; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
1795
|
use strict; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
103
|
|
4
|
3
|
|
|
3
|
|
16
|
use warnings; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
82
|
|
5
|
3
|
|
|
3
|
|
42
|
use v5.10.1; |
|
3
|
|
|
|
|
9
|
|
|
3
|
|
|
|
|
123
|
|
6
|
3
|
|
|
3
|
|
918
|
use utf8; |
|
3
|
|
|
|
|
14
|
|
|
3
|
|
|
|
|
26
|
|
7
|
|
|
|
|
|
|
|
8
|
3
|
|
|
3
|
|
69
|
use Carp; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
2184
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub new { |
11
|
4
|
|
|
4
|
0
|
7
|
my $class = shift; |
12
|
4
|
|
|
|
|
11
|
my %params = @_; |
13
|
|
|
|
|
|
|
|
14
|
4
|
|
|
|
|
11
|
my ( $pkg, undef, undef ) = caller; |
15
|
4
|
50
|
|
|
|
16
|
if ( $pkg ne 'TAP::Tree' ) { |
16
|
0
|
|
|
|
|
0
|
croak "Invalid call! This module must be called from inside TAP::Tree."; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
4
|
|
|
|
|
28
|
my $self = { |
20
|
|
|
|
|
|
|
tap_tree => $params{tap_tree}, |
21
|
|
|
|
|
|
|
subtest => $params{subtest}, |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
index_recursive => [], |
24
|
|
|
|
|
|
|
index_testline => 0, |
25
|
|
|
|
|
|
|
}; |
26
|
|
|
|
|
|
|
|
27
|
4
|
|
|
|
|
12
|
bless $self, $class; |
28
|
|
|
|
|
|
|
|
29
|
4
|
|
|
|
|
12
|
return $self; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub next { |
33
|
24
|
|
|
24
|
0
|
14081
|
my $self = shift; |
34
|
|
|
|
|
|
|
|
35
|
24
|
100
|
|
|
|
89
|
my $next = ( $self->{subtest} ) ? $self->_next_subtest : $self->_next; |
36
|
|
|
|
|
|
|
|
37
|
24
|
|
|
|
|
52
|
return $next; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub _next_subtest { |
41
|
21
|
|
|
21
|
|
24
|
my $self = shift; |
42
|
|
|
|
|
|
|
|
43
|
21
|
100
|
|
|
|
50
|
return if ( ! defined $self->{index_testline} ); |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
# get current test |
46
|
19
|
|
|
|
|
67
|
my $test = { |
47
|
|
|
|
|
|
|
plan => $self->{tap_tree}{plan}, |
48
|
|
|
|
|
|
|
testline => $self->{tap_tree}{testline}, |
49
|
|
|
|
|
|
|
}; |
50
|
|
|
|
|
|
|
|
51
|
19
|
|
|
|
|
25
|
for my $index ( @{ $self->{index_recursive} } ) { |
|
19
|
|
|
|
|
39
|
|
52
|
17
|
|
|
|
|
25
|
my $current = $test->{testline}[$index]{subtest}; |
53
|
|
|
|
|
|
|
|
54
|
17
|
|
|
|
|
74
|
$test = $current; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
# get current testline |
58
|
19
|
50
|
|
|
|
61
|
my $testline = ( defined $test->{testline}[$self->{index_testline}] ) ? |
59
|
|
|
|
|
|
|
$test->{testline}[$self->{index_testline}] : undef; |
60
|
|
|
|
|
|
|
|
61
|
19
|
|
|
|
|
55
|
my $next = { |
62
|
|
|
|
|
|
|
test => $test, |
63
|
|
|
|
|
|
|
testline => $testline, |
64
|
19
|
|
|
|
|
23
|
indent => scalar @{ $self->{index_recursive} }, |
65
|
|
|
|
|
|
|
}; |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
# set next index |
68
|
19
|
100
|
66
|
|
|
99
|
if ( $testline && $testline->{subtest} ) { |
69
|
8
|
|
|
|
|
10
|
push @{ $self->{index_recursive} }, $self->{index_testline}; |
|
8
|
|
|
|
|
17
|
|
70
|
8
|
|
|
|
|
11
|
$self->{index_testline} = 0; |
71
|
|
|
|
|
|
|
|
72
|
8
|
|
|
|
|
18
|
return $next; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
11
|
100
|
|
|
|
63
|
if ( defined $test->{testline}[$self->{index_testline} + 1 ] ) { |
76
|
4
|
|
|
|
|
8
|
$self->{index_testline} += 1; |
77
|
4
|
|
|
|
|
7
|
return $next; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
7
|
|
|
|
|
8
|
my $found; |
81
|
7
|
|
|
|
|
8
|
while ( @{ $self->{index_recursive} } ) { |
|
11
|
|
|
|
|
31
|
|
82
|
8
|
|
|
|
|
11
|
my $index_next = pop @{ $self->{index_recursive} }; |
|
8
|
|
|
|
|
13
|
|
83
|
|
|
|
|
|
|
|
84
|
8
|
|
|
|
|
19
|
my $nexttest = { |
85
|
|
|
|
|
|
|
testline => $self->{tap_tree}{testline}, |
86
|
|
|
|
|
|
|
}; |
87
|
|
|
|
|
|
|
|
88
|
8
|
|
|
|
|
11
|
for my $i ( @{ $self->{index_recursive} } ) { |
|
8
|
|
|
|
|
15
|
|
89
|
5
|
|
|
|
|
10
|
my $current = $nexttest->{testline}[$i]{subtest}; |
90
|
|
|
|
|
|
|
|
91
|
5
|
|
|
|
|
14
|
$nexttest = $current; |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
8
|
100
|
|
|
|
24
|
if ( defined $nexttest->{testline}[$index_next + 1] ) { |
95
|
4
|
|
|
|
|
6
|
$found = $index_next + 1; |
96
|
4
|
|
|
|
|
8
|
last; |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
7
|
100
|
|
|
|
16
|
if ( $found ) { |
101
|
4
|
|
|
|
|
7
|
$self->{index_testline} = $found; |
102
|
|
|
|
|
|
|
} else { |
103
|
3
|
|
|
|
|
5
|
$self->{index_testline} = undef; |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
|
106
|
7
|
|
|
|
|
14
|
return $next; |
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
sub _next { |
110
|
3
|
|
|
3
|
|
4
|
my $self = shift; |
111
|
|
|
|
|
|
|
|
112
|
3
|
|
|
|
|
11
|
my $test = { |
113
|
|
|
|
|
|
|
plan => $self->{tap_tree}{plan}, |
114
|
|
|
|
|
|
|
testline => $self->{tap_tree}{testline}, |
115
|
|
|
|
|
|
|
}; |
116
|
|
|
|
|
|
|
|
117
|
3
|
100
|
|
|
|
10
|
if ( defined $self->{tap_tree}{testline}[$self->{index_testline}] ) { |
118
|
2
|
|
|
|
|
4
|
my $testline = $self->{tap_tree}{testline}[$self->{index_testline}]; |
119
|
|
|
|
|
|
|
|
120
|
2
|
|
|
|
|
2
|
$self->{index_testline}++; |
121
|
|
|
|
|
|
|
|
122
|
2
|
|
|
|
|
8
|
return { test => $test, testline => $testline, indent => 0 }; |
123
|
|
|
|
|
|
|
} else { |
124
|
1
|
|
|
|
|
3
|
return; |
125
|
|
|
|
|
|
|
} |
126
|
|
|
|
|
|
|
} |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
1; |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
__END__ |