line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Clear; |
2
|
4
|
|
|
4
|
|
64376
|
use 5.008005; |
|
4
|
|
|
|
|
14
|
|
|
4
|
|
|
|
|
150
|
|
3
|
4
|
|
|
4
|
|
20
|
use strict; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
146
|
|
4
|
4
|
|
|
4
|
|
26
|
use warnings; |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
148
|
|
5
|
4
|
|
|
4
|
|
2921
|
use parent 'Exporter'; |
|
4
|
|
|
|
|
1413
|
|
|
4
|
|
|
|
|
21
|
|
6
|
4
|
|
|
4
|
|
294
|
use Test::More; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
29
|
|
7
|
4
|
|
|
4
|
|
990
|
use Test::Builder; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
77
|
|
8
|
4
|
|
|
4
|
|
4571
|
use Data::Dumper; |
|
4
|
|
|
|
|
38506
|
|
|
4
|
|
|
|
|
347
|
|
9
|
4
|
|
|
4
|
|
2631
|
use Scope::Guard; |
|
4
|
|
|
|
|
3046
|
|
|
4
|
|
|
|
|
2341
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = "0.03"; |
12
|
|
|
|
|
|
|
our @EXPORT = qw(case todo_scope todo_note); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub dumper { |
15
|
4
|
|
|
4
|
0
|
9
|
my $value = shift; |
16
|
4
|
50
|
|
|
|
16
|
if ( not defined $value ) { |
17
|
0
|
|
|
|
|
0
|
return 'undef'; |
18
|
|
|
|
|
|
|
} |
19
|
4
|
100
|
66
|
|
|
26
|
if ( defined $value && ref($value) ) { |
20
|
1
|
|
|
|
|
3
|
local $Data::Dumper::Terse = 1; |
21
|
1
|
|
|
|
|
4
|
local $Data::Dumper::Indent = 0; |
22
|
1
|
|
|
|
|
2
|
local $Data::Dumper::Sortkeys = 1; |
23
|
1
|
|
|
|
|
7
|
return Data::Dumper::Dumper($value); |
24
|
|
|
|
|
|
|
} |
25
|
3
|
|
|
|
|
16
|
return $value; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub case { |
29
|
4
|
|
|
4
|
1
|
12049
|
my ($caption, $dataset, $testcode, $opts) = @_; |
30
|
4
|
100
|
|
|
|
23
|
$dataset = (ref $dataset eq 'CODE') ? $dataset->(): $dataset; |
31
|
4
|
|
|
|
|
24
|
$caption = embeded($caption, $dataset); |
32
|
4
|
|
|
|
|
123
|
my $tb = Test::More->builder; |
33
|
4
|
|
|
|
|
51
|
return $tb->subtest($caption, $testcode, $dataset); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub embeded { |
37
|
4
|
|
|
4
|
0
|
10
|
my ($caption, $dataset) = @_; |
38
|
|
|
|
|
|
|
return |
39
|
8
|
100
|
|
|
|
52
|
join '', |
40
|
|
|
|
|
|
|
map { |
41
|
8
|
50
|
|
|
|
46
|
/^\{(.+?)\}$/ |
42
|
|
|
|
|
|
|
? dumper($dataset->{$1}) |
43
|
|
|
|
|
|
|
: $_ |
44
|
|
|
|
|
|
|
} |
45
|
4
|
|
|
|
|
38
|
grep { defined && length } |
46
|
|
|
|
|
|
|
split /(\{.+?\})/, $caption; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub todo_scope { |
50
|
1
|
|
|
1
|
1
|
1360
|
my ($reason) = @_; |
51
|
1
|
|
|
|
|
4
|
my $tb = Test::More->builder; |
52
|
1
|
|
|
|
|
14
|
$tb->todo_start($reason); |
53
|
1
|
|
|
1
|
|
52
|
Scope::Guard->new(sub { $tb->todo_end }); |
|
1
|
|
|
|
|
789
|
|
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub todo_note { |
57
|
2
|
|
|
2
|
0
|
22
|
my ($caption, $reason) = @_; |
58
|
2
|
|
100
|
|
|
10
|
$reason ||= ''; |
59
|
|
|
|
|
|
|
|
60
|
2
|
|
|
|
|
16
|
my (undef, $file, $line) = caller(0); |
61
|
2
|
|
|
|
|
8
|
$reason .= " [ $file line $line ]\n"; |
62
|
|
|
|
|
|
|
|
63
|
2
|
|
|
|
|
15
|
my $tb = Test::More->builder; |
64
|
2
|
|
|
|
|
23
|
$tb->todo_start($reason); |
65
|
2
|
|
|
|
|
117
|
pass $caption; |
66
|
2
|
|
|
|
|
1339
|
$tb->todo_end; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
1; |
70
|
|
|
|
|
|
|
__END__ |