line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Expr; |
2
|
|
|
|
|
|
|
our $VERSION = '0.000005'; |
3
|
|
|
|
|
|
|
|
4
|
2
|
|
|
2
|
|
16629
|
use 5.012; use warnings; |
|
2
|
|
|
2
|
|
8
|
|
|
2
|
|
|
|
|
11
|
|
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
53
|
|
5
|
2
|
|
|
2
|
|
1541
|
use Keyword::Declare; |
|
2
|
|
|
|
|
153940
|
|
|
2
|
|
|
|
|
22
|
|
6
|
2
|
|
|
2
|
|
1606
|
use Data::Dump; |
|
2
|
|
|
|
|
9635
|
|
|
2
|
|
|
|
|
160
|
|
7
|
2
|
|
|
2
|
|
19
|
use List::Util 'max'; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
128
|
|
8
|
2
|
|
|
2
|
|
822
|
use Test::More; |
|
2
|
|
|
|
|
20489
|
|
|
2
|
|
|
|
|
21
|
|
9
|
2
|
|
|
2
|
|
1674
|
use parent 'Exporter'; |
|
2
|
|
|
|
|
543
|
|
|
2
|
|
|
|
|
12
|
|
10
|
|
|
|
|
|
|
our @EXPORT = @Test::More::EXPORT; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub _trim { |
13
|
0
|
|
|
0
|
|
0
|
my $str = shift; |
14
|
0
|
|
|
|
|
0
|
$str =~ s{\A\s*|\s*\Z}{}g; |
15
|
0
|
|
|
|
|
0
|
return $str; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
my $PERL_VAR = qr{ ((?&PerlVariable)) $PPR::GRAMMAR }xms; |
19
|
|
|
|
|
|
|
|
20
|
0
|
|
|
|
|
|
sub import { |
21
|
2
|
|
|
2
|
|
41
|
my ($package) = @_; |
22
|
2
|
|
|
|
|
515
|
$package->export_to_level(1, @_); |
23
|
2
|
|
|
|
|
8
|
|
24
|
2
|
50
|
50
|
|
|
42
|
keyword ok (Expr $test) {{{ |
25
|
2
|
|
|
|
|
15
|
ok do{«$test»}, q{«$test»}; |
26
|
|
|
|
|
|
|
}}} |
27
|
2
|
|
|
|
|
156
|
|
28
|
2
|
50
|
50
|
|
|
30
|
keyword ok (ListElem $test, Comma, ListElem $desc) { |
29
|
2
|
|
|
2
|
|
66452
|
# Work out what values to report if there's a problem... |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
12
|
|
30
|
2
|
|
|
|
|
5
|
my @vars = grep {defined} $test =~ m{$PERL_VAR}g; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
10
|
|
31
|
2
|
|
|
|
|
25
|
my $var_len = max map {length} @vars; |
32
|
|
|
|
|
|
|
my %seen; |
33
|
2
|
|
|
2
|
|
25122
|
my @diagnostics |
|
3
|
|
|
3
|
|
83008
|
|
|
3
|
|
|
|
|
10
|
|
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
5
|
|
34
|
|
|
|
|
|
|
= map {qq{diag sprintf(q{ %${var_len}s --> }, q{$_}), Data::Dump::dump($_);}} |
35
|
3
|
|
|
|
|
187
|
grep { !$seen{$_}++ } |
|
0
|
|
|
|
|
0
|
|
36
|
3
|
|
|
|
|
14
|
@vars; |
|
0
|
|
|
|
|
0
|
|
37
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
3
|
|
|
|
|
6
|
|
38
|
0
|
|
|
|
|
0
|
unshift @diagnostics, qq{diag q{ because:};} |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
39
|
2
|
|
|
|
|
19
|
if @diagnostics; |
|
0
|
|
|
|
|
0
|
|
40
|
3
|
|
|
|
|
9
|
unshift @diagnostics, qq{diag q{}; diag q{ ($test) was false};} |
|
0
|
|
|
|
|
0
|
|
41
|
|
|
|
|
|
|
if (eval($desc)//'') ne qq{$test}; |
42
|
|
|
|
|
|
|
|
43
|
3
|
50
|
|
|
|
13
|
# Build the test code... |
44
|
|
|
|
|
|
|
qq{ |
45
|
3
|
50
|
50
|
|
|
214
|
if ($test) { |
46
|
|
|
|
|
|
|
Test::More::ok(1, $desc); |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
else { |
49
|
3
|
|
|
|
|
30
|
fail($desc); @diagnostics diag q{}; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
}; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
1; # Magic true value required at end of module |
56
|
|
|
|
|
|
|
__END__ |