line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Mini::TestCase; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
4254
|
use 5.006; |
|
4
|
|
|
|
|
12
|
|
4
|
4
|
|
|
4
|
|
18
|
use strict; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
201
|
|
5
|
4
|
|
|
4
|
|
17
|
use warnings; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
89
|
|
6
|
|
|
|
|
|
|
|
7
|
4
|
|
|
4
|
|
1293
|
use Test::Mini; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
110
|
|
8
|
4
|
|
|
4
|
|
2898
|
use Exception::Class; |
|
4
|
|
|
|
|
41060
|
|
|
4
|
|
|
|
|
25
|
|
9
|
4
|
|
|
4
|
|
2036
|
use Test::Mini::Assertions; |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
20
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub new { |
12
|
54
|
|
|
54
|
1
|
144
|
my ($class, %args) = @_; |
13
|
54
|
|
|
|
|
291
|
return bless { %args, passed => 0 }, $class; |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub setup { |
17
|
36
|
|
|
36
|
1
|
170
|
my ($self) = @_; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub teardown { |
21
|
54
|
|
|
54
|
1
|
98
|
my ($self) = @_; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub run { |
25
|
54
|
|
|
54
|
1
|
83
|
my ($self, $runner) = @_; |
26
|
54
|
|
|
|
|
60
|
my $e; |
27
|
54
|
|
|
|
|
112
|
my $test = $self->{name}; |
28
|
|
|
|
|
|
|
|
29
|
54
|
|
|
|
|
67
|
eval { |
30
|
|
|
|
|
|
|
local $SIG{__DIE__} = sub { |
31
|
|
|
|
|
|
|
# Package declaration for isolating the callstack. |
32
|
|
|
|
|
|
|
# @api private |
33
|
|
|
|
|
|
|
package Test::Mini::SIGDIE; |
34
|
|
|
|
|
|
|
|
35
|
118
|
100
|
|
118
|
|
1417
|
die $_[0] if eval {$_[0]->isa('Test::Mini::Exception')}; |
|
118
|
|
|
|
|
1139
|
|
36
|
|
|
|
|
|
|
|
37
|
116
|
|
|
|
|
923
|
(my $msg = "@_") =~ s/ at .*? line \d+\.\n$//; |
38
|
116
|
|
|
|
|
651
|
my $error = Test::Mini::Exception->new( |
39
|
|
|
|
|
|
|
message => "$msg\n", |
40
|
|
|
|
|
|
|
ignore_package => [qw/ Test::Mini::SIGDIE Carp /], |
41
|
|
|
|
|
|
|
); |
42
|
|
|
|
|
|
|
|
43
|
116
|
|
|
|
|
88463
|
my $me = $error->trace->frame(0); |
44
|
116
|
50
|
|
|
|
95368
|
if ($me->{subroutine} eq 'Test::Mini::TestCase::__ANON__') { |
45
|
116
|
|
|
|
|
213
|
$me->{subroutine} = 'die'; |
46
|
116
|
|
|
|
|
269
|
$me->{args} = [ $msg ]; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
116
|
|
|
|
|
1482
|
die $error; |
50
|
54
|
|
|
|
|
388
|
}; |
51
|
|
|
|
|
|
|
|
52
|
54
|
|
|
|
|
171
|
$self->setup(); |
53
|
54
|
|
|
|
|
252
|
$self->$test(); |
54
|
51
|
|
|
|
|
195
|
$self->{passed} = 1; |
55
|
|
|
|
|
|
|
|
56
|
51
|
100
|
|
|
|
137
|
die 'No assertions called' unless count_assertions(); |
57
|
|
|
|
|
|
|
}; |
58
|
|
|
|
|
|
|
|
59
|
54
|
100
|
|
|
|
550
|
if ($e = Exception::Class->caught()) { |
60
|
4
|
|
|
|
|
39
|
$self->{passed} = 0; |
61
|
|
|
|
|
|
|
|
62
|
4
|
100
|
|
|
|
9
|
if ($e = Exception::Class->caught('Test::Mini::Exception::Skip')) { |
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
63
|
1
|
|
|
|
|
14
|
$runner->skip(ref $self, $test, $e); |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
elsif ($e = Exception::Class->caught('Test::Mini::Exception::Assert')) { |
66
|
1
|
|
|
|
|
23
|
$runner->fail(ref $self, $test, $e); |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
elsif ($e = Exception::Class->caught('Test::Mini::Exception')) { |
69
|
2
|
|
|
|
|
66
|
$runner->error(ref $self, $test, $e); |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
54
|
|
|
|
|
312
|
eval { |
74
|
54
|
|
|
|
|
147
|
$self->teardown(); |
75
|
54
|
100
|
|
|
|
266
|
$runner->pass(ref $self, $self->{name}) if $self->{passed}; |
76
|
|
|
|
|
|
|
}; |
77
|
54
|
50
|
|
|
|
318
|
if ($e = Exception::Class->caught()) { |
78
|
0
|
|
|
|
|
0
|
$runner->error(ref $self, $test, $e); |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
54
|
|
|
|
|
501
|
return reset_assertions(); |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
1; |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
__END__ |