line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MyTest; |
2
|
3
|
|
|
3
|
|
8424
|
use strict; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
116
|
|
3
|
|
|
|
|
|
|
|
4
|
3
|
|
|
3
|
|
3571
|
use Test qw< plan ok skip >; |
|
3
|
|
|
|
|
16847
|
|
|
3
|
|
|
|
|
317
|
|
5
|
3
|
|
|
3
|
|
30
|
use vars qw< @EXPORT_OK >; |
|
3
|
|
|
|
|
10
|
|
|
3
|
|
|
|
|
196
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
BEGIN { |
8
|
3
|
|
|
3
|
|
12
|
@EXPORT_OK= qw< plan ok skip Okay SkipIf Lives Dies >; |
9
|
3
|
|
|
|
|
16
|
require Exporter; |
10
|
3
|
|
|
|
|
1986
|
*import= \&Exporter::import; |
11
|
|
|
|
|
|
|
} |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
$|= 1; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
return 1; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub Okay($;$$) { |
19
|
19
|
50
|
|
19
|
0
|
129627
|
@_= @_ < 3 ? reverse @_ : @_[1,0,2]; |
20
|
19
|
|
|
|
|
110
|
goto &ok; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub SkipIf($;$$$) { |
25
|
1
|
|
|
1
|
0
|
3
|
my $skip= shift @_; |
26
|
1
|
50
|
33
|
|
|
7
|
die "Can't not skip a non-test" |
27
|
|
|
|
|
|
|
if ! $skip && ! @_; |
28
|
1
|
50
|
33
|
|
|
8
|
$skip= 'Prior test failed' |
29
|
|
|
|
|
|
|
if $skip && 1 eq $skip; |
30
|
1
|
50
|
|
|
|
15
|
@_= @_ < 3 ? reverse @_ : @_[1,0,2]; |
31
|
1
|
|
|
|
|
5
|
@_= ( $skip, @_ ); |
32
|
1
|
|
|
|
|
6
|
goto &skip; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub Lives { |
37
|
0
|
|
|
0
|
0
|
0
|
my( $code, $desc )= @_; |
38
|
0
|
|
|
|
|
0
|
my( $pkg, $file, $line )= caller(); |
39
|
0
|
0
|
|
|
|
0
|
if( ref $code ) { |
40
|
0
|
|
0
|
|
|
0
|
$desc ||= "$file line $line"; |
41
|
0
|
|
|
|
|
0
|
@_= ( 1, eval { $code->(); 1 }, "Should not die:\n$desc\n$@" ); |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
42
|
0
|
|
|
|
|
0
|
goto &Okay; |
43
|
|
|
|
|
|
|
} else { |
44
|
0
|
|
0
|
|
|
0
|
$desc ||= $code; |
45
|
0
|
|
|
|
|
0
|
++$line; |
46
|
0
|
|
|
|
|
0
|
my $eval= qq(\n#line $line "$file"\n) . $code . "\n1;\n"; |
47
|
0
|
|
|
|
|
0
|
@_= ( 1, eval $eval, "Should not die:\n$desc\n$@" ); |
48
|
0
|
|
|
|
|
0
|
goto &Okay; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub Dies { |
54
|
1
|
|
|
1
|
0
|
13
|
my( $code, $omen, $desc )= @_; |
55
|
1
|
|
|
|
|
4
|
my( $pkg, $file, $line )= caller(); |
56
|
1
|
|
|
|
|
3
|
++$line; |
57
|
1
|
50
|
|
|
|
4
|
if( ref $code ) { |
58
|
1
|
|
33
|
|
|
3
|
$desc ||= "$file line $line"; |
59
|
|
|
|
|
|
|
@_= ( |
60
|
1
|
|
|
|
|
3
|
! Okay( undef, eval { $code->(); 1 }, "Should die:\n$desc" ), |
|
1
|
|
|
|
|
4
|
|
|
0
|
|
|
|
|
0
|
|
61
|
|
|
|
|
|
|
$omen, $@, "Error from:\n$desc", |
62
|
|
|
|
|
|
|
); |
63
|
|
|
|
|
|
|
} else { |
64
|
0
|
|
0
|
|
|
0
|
$desc ||= $code; |
65
|
0
|
|
|
|
|
0
|
my $eval= qq(\n#line $line "$file"\n) . $code . "\n1;\n"; |
66
|
0
|
|
|
|
|
0
|
@_= ( |
67
|
|
|
|
|
|
|
! Okay( undef, eval $eval, "Should die:\n$desc" ), |
68
|
|
|
|
|
|
|
$omen, $@, "Error from:\n$desc", |
69
|
|
|
|
|
|
|
); |
70
|
|
|
|
|
|
|
} |
71
|
1
|
|
|
|
|
76
|
goto &SkipIf; |
72
|
|
|
|
|
|
|
} |