line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Clear; |
2
|
4
|
|
|
4
|
|
68399
|
use 5.008005; |
|
4
|
|
|
|
|
15
|
|
|
4
|
|
|
|
|
162
|
|
3
|
4
|
|
|
4
|
|
20
|
use strict; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
151
|
|
4
|
4
|
|
|
4
|
|
26
|
use warnings; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
130
|
|
5
|
4
|
|
|
4
|
|
2462
|
use parent 'Exporter'; |
|
4
|
|
|
|
|
1097
|
|
|
4
|
|
|
|
|
130
|
|
6
|
4
|
|
|
4
|
|
192
|
use Test::More; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
25
|
|
7
|
4
|
|
|
4
|
|
915
|
use Test::Builder; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
73
|
|
8
|
4
|
|
|
4
|
|
2788
|
use Data::Dumper; |
|
4
|
|
|
|
|
31043
|
|
|
4
|
|
|
|
|
354
|
|
9
|
4
|
|
|
4
|
|
2199
|
use Scope::Guard; |
|
4
|
|
|
|
|
1748
|
|
|
4
|
|
|
|
|
1817
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = "0.02"; |
12
|
|
|
|
|
|
|
our @EXPORT = qw(case todo_scope todo_note); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub dumper { |
15
|
4
|
|
|
4
|
0
|
7
|
my $value = shift; |
16
|
4
|
50
|
|
|
|
9
|
if ( not defined $value ) { |
17
|
0
|
|
|
|
|
0
|
return 'undef'; |
18
|
|
|
|
|
|
|
} |
19
|
4
|
100
|
66
|
|
|
21
|
if ( defined $value && ref($value) ) { |
20
|
1
|
|
|
|
|
2
|
local $Data::Dumper::Terse = 1; |
21
|
1
|
|
|
|
|
3
|
local $Data::Dumper::Indent = 0; |
22
|
1
|
|
|
|
|
2
|
local $Data::Dumper::Sortkeys = 1; |
23
|
1
|
|
|
|
|
5
|
return Data::Dumper::Dumper($value); |
24
|
|
|
|
|
|
|
} |
25
|
3
|
|
|
|
|
10
|
return $value; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub case { |
29
|
4
|
|
|
4
|
1
|
6998
|
my ($caption, $dataset, $testcode, $opts) = @_; |
30
|
4
|
100
|
|
|
|
17
|
$dataset = (ref $dataset eq 'CODE') ? $dataset->(): $dataset; |
31
|
4
|
|
|
|
|
18
|
$caption = embeded($caption, $dataset); |
32
|
4
|
|
|
|
|
97
|
my $tb = Test::More->builder; |
33
|
4
|
|
|
|
|
39
|
return $tb->subtest($caption, $testcode, $dataset); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub embeded { |
37
|
4
|
|
|
4
|
0
|
7
|
my ($caption, $dataset) = @_; |
38
|
|
|
|
|
|
|
return |
39
|
8
|
100
|
|
|
|
38
|
join '', |
40
|
|
|
|
|
|
|
map { |
41
|
8
|
50
|
|
|
|
36
|
/^\{(.+?)\}$/ |
42
|
|
|
|
|
|
|
? dumper($dataset->{$1}) |
43
|
|
|
|
|
|
|
: $_ |
44
|
|
|
|
|
|
|
} |
45
|
4
|
|
|
|
|
28
|
grep { defined && length } |
46
|
|
|
|
|
|
|
split /(\{.+?\})/, $caption; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub todo_scope { |
50
|
1
|
|
|
1
|
1
|
1344
|
my ($reason) = @_; |
51
|
1
|
|
|
|
|
4
|
my $tb = Test::More->builder; |
52
|
1
|
|
|
|
|
14
|
$tb->todo_start($reason); |
53
|
1
|
|
|
1
|
|
54
|
Scope::Guard->new(sub { $tb->todo_end }); |
|
1
|
|
|
|
|
600
|
|
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub todo_note { |
57
|
2
|
|
|
2
|
0
|
27
|
my ($caption, $reason) = @_; |
58
|
2
|
|
100
|
|
|
11
|
$reason ||= ''; |
59
|
2
|
|
|
|
|
21
|
my $tb = Test::More->builder; |
60
|
2
|
|
|
|
|
34
|
$tb->todo_start($reason); |
61
|
2
|
|
|
|
|
119
|
fail $caption; |
62
|
2
|
|
|
|
|
2783
|
$tb->todo_end; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
1; |
66
|
|
|
|
|
|
|
__END__ |