line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#!/usr/bin/perl -w |
2
|
1
|
|
|
1
|
|
98391
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
61
|
|
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
458
|
use Test::More tests => 15; |
|
1
|
|
|
|
|
14854
|
|
|
1
|
|
|
|
|
7
|
|
5
|
1
|
|
|
1
|
|
38608
|
use Test::Exception; |
|
1
|
|
|
|
|
3768
|
|
|
1
|
|
|
|
|
5
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
643
|
use Data::Dumper; |
|
1
|
|
|
|
|
5732
|
|
|
1
|
|
|
|
|
49
|
|
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
282
|
use Devel::PerlySense::Util; |
|
1
|
|
|
|
|
43245
|
|
|
1
|
|
|
|
|
52
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
285
|
use lib "lib"; |
|
1
|
|
|
|
|
541
|
|
|
1
|
|
|
|
|
4
|
|
13
|
|
|
|
|
|
|
|
14
|
1
|
|
|
1
|
|
100206
|
use_ok("Devel::PerlySense"); |
|
1
|
|
|
|
|
22374
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
7
|
|
15
|
1
|
|
|
1
|
|
275
|
use_ok("Devel::PerlySense::Bookmark::Definition"); |
|
1
|
|
|
|
|
78
|
|
|
1
|
|
|
|
|
11
|
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
6
|
|
16
|
1
|
|
|
1
|
|
196
|
use_ok("Devel::PerlySense::Bookmark::Match"); |
|
1
|
|
|
|
|
54
|
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
6
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
#ok(my $oPerlySense = Devel::PerlySense->new(), "new PerlySense"); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
24
|
1
|
|
|
|
|
190
|
my $dirData = "t/data/project-lib"; |
25
|
1
|
|
|
|
|
3
|
my $fileOrigin = "$dirData/Game/Object/Worm/ShaiHulud.pm"; |
26
|
1
|
|
|
|
|
5
|
my $source = slurp($fileOrigin); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
|
29
|
1
|
|
|
|
|
22498
|
my @aMatch; |
30
|
1
|
|
|
|
|
8
|
my $oDefinitionTodo; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
34
|
1
|
|
|
|
|
7
|
note("Find matches"); |
35
|
|
|
|
|
|
|
|
36
|
1
|
|
|
|
|
115
|
$oDefinitionTodo = Devel::PerlySense::Bookmark::Definition->newFromConfig( |
37
|
|
|
|
|
|
|
moniker => "test1", |
38
|
|
|
|
|
|
|
rex => 'qr/\# \s* TODO: \s* ( .+ )/x', |
39
|
|
|
|
|
|
|
); |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|
42
|
1
|
|
|
|
|
4
|
@aMatch = $oDefinitionTodo->aMatch(file => $fileOrigin, source => $source); |
43
|
1
|
|
|
|
|
5
|
is(scalar @aMatch, 3, "Found correct number of matches"); |
44
|
|
|
|
|
|
|
|
45
|
1
|
|
|
|
|
245
|
my $oMatch = $aMatch[0]; |
46
|
1
|
|
|
|
|
5
|
isa_ok($oMatch, "Devel::PerlySense::Bookmark::Match"); |
47
|
|
|
|
|
|
|
|
48
|
1
|
|
|
|
|
261
|
is($oMatch->oDefinition, $oDefinitionTodo, " oDefinition points to correct object"); |
49
|
1
|
|
|
|
|
210
|
is($oMatch->line, ' ##TODO: Fix something here', " line ok"); |
50
|
1
|
|
|
|
|
211
|
is($oMatch->text, 'Fix something here', " text ok"); |
51
|
|
|
|
|
|
|
|
52
|
1
|
|
|
|
|
210
|
isa_ok($oMatch->oLocation, "Devel::PerlySense::Document::Location"); |
53
|
1
|
|
|
|
|
247
|
like($oMatch->oLocation->file, qr|Worm.ShaiHulud.pm|, " Location file ok"); |
54
|
1
|
|
|
|
|
212
|
is($oMatch->oLocation->row, 76, " Location row ok"); |
55
|
1
|
|
|
|
|
785
|
is($oMatch->oLocation->col, 0, " Location row ok"); |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
|
60
|
1
|
|
|
|
|
191
|
note("Test multiple regexes, and that a definition only matches the first one"); |
61
|
1
|
|
|
|
|
47
|
$oDefinitionTodo = Devel::PerlySense::Bookmark::Definition->newFromConfig( |
62
|
|
|
|
|
|
|
moniker => "test1", |
63
|
|
|
|
|
|
|
rex => [ |
64
|
|
|
|
|
|
|
'qr/(abc)/x', |
65
|
|
|
|
|
|
|
'qr/(123)/x', |
66
|
|
|
|
|
|
|
], |
67
|
|
|
|
|
|
|
); |
68
|
1
|
|
|
|
|
3
|
$source = q {nope |
69
|
|
|
|
|
|
|
abc |
70
|
|
|
|
|
|
|
123 |
71
|
|
|
|
|
|
|
abc123}; |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
|
74
|
1
|
|
|
|
|
4
|
@aMatch = $oDefinitionTodo->aMatch(file => $fileOrigin, source => $source); |
75
|
1
|
|
|
|
|
4
|
is(scalar @aMatch, 3, "Found correct number of matches"); |
76
|
|
|
|
|
|
|
|
77
|
3
|
|
|
|
|
77
|
is_deeply( |
78
|
1
|
|
|
|
|
190
|
[ map { $_->text } @aMatch ], |
79
|
|
|
|
|
|
|
[ "abc", "123", "abc" ], |
80
|
|
|
|
|
|
|
"All matches matched only once, and in the correct order", |
81
|
|
|
|
|
|
|
); |
82
|
3
|
|
|
|
|
119
|
is_deeply( |
83
|
1
|
|
|
|
|
420
|
[ map { $_->oLocation->row } @aMatch ], |
84
|
|
|
|
|
|
|
[ 2, 3, 4 ], |
85
|
|
|
|
|
|
|
"All matches matched on the correct row", |
86
|
|
|
|
|
|
|
); |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
__END__ |