line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Stream::Plugin::SpecDeclare; |
2
|
6
|
|
|
6
|
|
1759826
|
use strict; |
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
144
|
|
3
|
6
|
|
|
6
|
|
27
|
use warnings; |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
156
|
|
4
|
|
|
|
|
|
|
|
5
|
6
|
|
|
6
|
|
89
|
use Carp qw/confess croak/; |
|
6
|
|
|
|
|
10
|
|
|
6
|
|
|
|
|
279
|
|
6
|
|
|
|
|
|
|
|
7
|
6
|
|
|
6
|
|
31
|
use Test::Stream::Plugin; |
|
6
|
|
|
|
|
8
|
|
|
6
|
|
|
|
|
40
|
|
8
|
6
|
|
|
6
|
|
58154
|
use Devel::Declare; |
|
6
|
|
|
|
|
327766
|
|
|
6
|
|
|
|
|
55
|
|
9
|
6
|
|
|
6
|
|
6830
|
use B::Hooks::EndOfScope; |
|
6
|
|
|
|
|
141313
|
|
|
6
|
|
|
|
|
60
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = "0.000001"; |
12
|
|
|
|
|
|
|
our $DEBUG = 0; |
13
|
|
|
|
|
|
|
our $RECORD = 0; |
14
|
|
|
|
|
|
|
our @RECORD; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub load_ts_plugin { |
17
|
6
|
|
|
6
|
0
|
171
|
my $class = shift; |
18
|
6
|
|
|
|
|
19
|
my $caller = shift; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
Devel::Declare->setup_for( |
21
|
|
|
|
|
|
|
$caller->[0], |
22
|
|
|
|
|
|
|
{ |
23
|
6
|
|
|
|
|
26
|
map { $_ => { const => \&parser } } grep { $caller->[0]->can($_) } qw{ |
|
84
|
|
|
|
|
345
|
|
|
84
|
|
|
|
|
398
|
|
24
|
|
|
|
|
|
|
describe cases |
25
|
|
|
|
|
|
|
tests it |
26
|
|
|
|
|
|
|
case |
27
|
|
|
|
|
|
|
before_all after_all around_all |
28
|
|
|
|
|
|
|
before_case after_case around_case |
29
|
|
|
|
|
|
|
before_each after_each around_each |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
}, |
32
|
|
|
|
|
|
|
); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub parser { |
36
|
63
|
|
|
63
|
0
|
5530
|
my ($dec, $offset) = @_; |
37
|
63
|
|
|
|
|
214
|
$offset += Devel::Declare::toke_move_past_token($offset); |
38
|
63
|
|
|
|
|
169
|
$offset += Devel::Declare::toke_skipspace($offset); |
39
|
|
|
|
|
|
|
|
40
|
63
|
|
|
|
|
98
|
my ($name, $meta); |
41
|
|
|
|
|
|
|
|
42
|
0
|
|
|
|
|
0
|
my @restore; |
43
|
|
|
|
|
|
|
my $restore = sub { |
44
|
11
|
|
|
11
|
|
44
|
my $line = Devel::Declare::get_linestr(); |
45
|
11
|
50
|
|
|
|
54
|
push @RECORD => [0, $line, @restore] if $RECORD; |
46
|
11
|
50
|
|
|
|
39
|
print "MANGLE: |$line|\n" if $DEBUG; |
47
|
11
|
|
|
|
|
52
|
for my $set (reverse @restore) { |
48
|
8
|
|
|
|
|
33
|
my ($offset, $len, $val) = @$set; |
49
|
8
|
|
|
|
|
36
|
substr($line, $offset, $len) = $val; |
50
|
|
|
|
|
|
|
} |
51
|
11
|
|
|
|
|
35
|
Devel::Declare::set_linestr($line); |
52
|
11
|
50
|
|
|
|
37
|
print "FIXED: |$line|\n" if $DEBUG; |
53
|
11
|
|
|
|
|
194
|
return 0; |
54
|
63
|
|
|
|
|
408
|
}; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
# Get name |
57
|
63
|
|
|
|
|
247
|
my $line = Devel::Declare::get_linestr(); |
58
|
63
|
|
|
|
|
161
|
my $start = substr($line, $offset, 1); |
59
|
|
|
|
|
|
|
|
60
|
63
|
100
|
100
|
|
|
602
|
if ($start eq '"' || $start eq "'") { |
|
|
100
|
|
|
|
|
|
61
|
19
|
|
|
|
|
151
|
my $len = Devel::Declare::toke_scan_str($offset); |
62
|
19
|
|
|
|
|
67
|
$name = Devel::Declare::get_lex_stuff(); |
63
|
19
|
|
|
|
|
55
|
Devel::Declare::clear_lex_stuff(); |
64
|
19
|
|
|
|
|
28
|
$offset += $len; |
65
|
19
|
|
|
|
|
53
|
substr($line, $offset, 0) = ", "; |
66
|
19
|
|
|
|
|
57
|
Devel::Declare::set_linestr($line); |
67
|
19
|
|
|
|
|
59
|
push @restore => [$offset, 2, ""]; |
68
|
19
|
|
|
|
|
48
|
$offset += 2; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
elsif (my $nlen = Devel::Declare::toke_scan_word($offset, 1)) { |
71
|
41
|
|
|
|
|
100
|
$name = substr($line, $offset, $nlen); |
72
|
41
|
|
|
|
|
88
|
my $new = "$name => "; |
73
|
41
|
|
|
|
|
94
|
substr($line, $offset, $nlen) = $new; |
74
|
41
|
|
|
|
|
104
|
Devel::Declare::set_linestr($line); |
75
|
41
|
|
|
|
|
159
|
push @restore => [$offset, length($new), $name]; |
76
|
41
|
|
|
|
|
103
|
$offset += length($new); |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
63
|
100
|
|
|
|
203
|
return $restore->() unless defined $name; |
80
|
|
|
|
|
|
|
|
81
|
60
|
|
|
|
|
168
|
$offset += Devel::Declare::toke_skipspace($offset); |
82
|
|
|
|
|
|
|
|
83
|
60
|
|
|
|
|
175
|
$line = Devel::Declare::get_linestr(); |
84
|
60
|
|
|
|
|
141
|
$start = substr($line, $offset, 1); |
85
|
60
|
100
|
|
|
|
188
|
if ($start eq '(') { |
86
|
13
|
|
|
|
|
101
|
my $len = Devel::Declare::toke_scan_str($offset); |
87
|
13
|
|
|
|
|
50
|
$line = Devel::Declare::get_linestr(); |
88
|
13
|
|
|
|
|
63
|
$meta = Devel::Declare::get_lex_stuff(); |
89
|
13
|
|
|
|
|
27
|
Devel::Declare::clear_lex_stuff(); |
90
|
13
|
|
|
|
|
30
|
my $new = "{$meta}, "; |
91
|
13
|
|
|
|
|
32
|
substr($line, $offset, $len) = $new; |
92
|
13
|
|
|
|
|
46
|
push @restore => [$offset, length($new), "($meta)"]; |
93
|
13
|
|
|
|
|
36
|
Devel::Declare::set_linestr($line); |
94
|
13
|
|
|
|
|
26
|
$offset += length($new); |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
|
97
|
60
|
|
|
|
|
156
|
$offset += Devel::Declare::toke_skipspace($offset); |
98
|
60
|
|
|
|
|
152
|
$line = Devel::Declare::get_linestr(); |
99
|
60
|
|
|
|
|
127
|
$start = substr($line, $offset, 1); |
100
|
|
|
|
|
|
|
|
101
|
60
|
100
|
|
|
|
331
|
return $restore->() unless $start eq '{'; |
102
|
|
|
|
|
|
|
|
103
|
52
|
|
|
|
|
85
|
my $new = "sub { BEGIN { Test::Stream::Plugin::SpecDeclare::inject_scope() }; "; |
104
|
52
|
|
|
|
|
120
|
substr($line, $offset, 1) = $new; |
105
|
52
|
|
|
|
|
144
|
Devel::Declare::set_linestr($line); |
106
|
52
|
50
|
|
|
|
139
|
print STDERR "$line\n" if $DEBUG; |
107
|
52
|
50
|
|
|
|
902
|
push @RECORD => [1, $line, @restore] if $RECORD; |
108
|
|
|
|
|
|
|
} |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
sub inject_scope { |
111
|
|
|
|
|
|
|
on_scope_end { |
112
|
52
|
|
|
52
|
|
2758
|
my $linestr = Devel::Declare::get_linestr(); |
113
|
52
|
|
|
|
|
143
|
my $offset = Devel::Declare::get_linestr_offset(); |
114
|
52
|
|
|
|
|
143
|
substr($linestr, $offset, 0) = ';'; |
115
|
52
|
|
|
|
|
223
|
Devel::Declare::set_linestr($linestr); |
116
|
|
|
|
|
|
|
} |
117
|
52
|
|
|
52
|
0
|
4265
|
} |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
1; |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
__END__ |