line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# $Header: /home/fergal/my/cvs/Code-Perl/lib/Code/Perl/Test/Expr.pm,v 1.1 2003/06/17 15:14:55 fergal Exp $ |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
28234
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
28
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
45
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
package Code::Perl::Test::Expr; |
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
9
|
use Test::More; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
5
|
|
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
1234
|
use Test::Deep qw( cmp_deeply ); |
|
1
|
|
|
|
|
11654
|
|
|
1
|
|
|
|
|
81
|
|
12
|
1
|
|
|
1
|
|
6656
|
use Data::Dumper qw(Dumper); |
|
1
|
|
|
|
|
15319
|
|
|
1
|
|
|
|
|
81
|
|
13
|
1
|
|
|
1
|
|
8
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
567
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
my $do_not_run = {}; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub do_not_run |
18
|
|
|
|
|
|
|
{ |
19
|
1
|
|
|
1
|
0
|
10
|
return $do_not_run; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub listcon |
23
|
|
|
|
|
|
|
{ |
24
|
3
|
|
|
3
|
0
|
91
|
return ListCon->new(@_); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub test_exprs |
28
|
|
|
|
|
|
|
{ |
29
|
1
|
|
|
1
|
0
|
11
|
my @tests = @_; |
30
|
1
|
|
|
|
|
3
|
my $test_count = 0; |
31
|
1
|
|
|
|
|
2
|
for my $test (@tests) |
32
|
|
|
|
|
|
|
{ |
33
|
20
|
|
|
|
|
11544
|
$test_count++; |
34
|
20
|
|
|
|
|
67
|
my ($name, $env, $comp, $exp_value, $exp_code) = @$test; |
35
|
|
|
|
|
|
|
|
36
|
20
|
|
|
|
|
44
|
$name = "$test_count: $name"; |
37
|
20
|
|
|
|
|
29
|
my $code = eval {$comp->perl}; |
|
20
|
|
|
|
|
108
|
|
38
|
20
|
50
|
|
|
|
171
|
die "$@\n".Dumper($comp) if $@; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
SKIP: |
41
|
|
|
|
|
|
|
{ |
42
|
20
|
100
|
|
|
|
25
|
if (defined $exp_code) |
|
20
|
|
|
|
|
45
|
|
43
|
|
|
|
|
|
|
{ |
44
|
19
|
50
|
|
|
|
82
|
is($code, $exp_code, "$name - code") || diag(Dumper($comp)); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
else |
47
|
|
|
|
|
|
|
{ |
48
|
1
|
|
|
|
|
8
|
skip("no code supplied", 1); |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
SKIP: |
53
|
|
|
|
|
|
|
{ |
54
|
20
|
100
|
|
|
|
7587
|
if ($exp_value eq $do_not_run) |
|
20
|
|
|
|
|
82
|
|
55
|
|
|
|
|
|
|
{ |
56
|
1
|
|
|
|
|
6
|
skip("do not run", 3); |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
else |
59
|
|
|
|
|
|
|
{ |
60
|
19
|
|
|
|
|
56
|
my $list_con = ref($exp_value) eq "ListCon"; |
61
|
|
|
|
|
|
|
|
62
|
19
|
|
|
|
|
30
|
$main::env = $env; |
63
|
|
|
|
|
|
|
|
64
|
19
|
100
|
|
|
|
98
|
my $eval_value = $list_con ? listcon($comp->eval) : $comp->eval; |
65
|
19
|
50
|
|
|
|
361
|
cmp_deeply($eval_value, $exp_value, "$name - value") || diag(Dumper($comp)); |
66
|
|
|
|
|
|
|
|
67
|
19
|
100
|
|
|
|
32806
|
my $perl_value = $list_con ? listcon(eval $code) : eval $code; |
68
|
|
|
|
|
|
|
|
69
|
19
|
50
|
|
|
|
160
|
ok(! $@, "$name - evalperl") || diag "$@\ncode was\n$code"; |
70
|
19
|
50
|
|
|
|
7223
|
cmp_deeply($perl_value, $exp_value, "$name - evalperl value") || diag($code); |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
package ListCon; |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub new |
80
|
|
|
|
|
|
|
{ |
81
|
3
|
|
|
3
|
|
7
|
my $pkg = shift; |
82
|
|
|
|
|
|
|
|
83
|
3
|
|
|
|
|
9
|
my @list = @_; |
84
|
3
|
|
|
|
|
19
|
return bless \@list, $pkg; |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
1; |