line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
83399
|
use 5.006; use strict; use warnings; |
|
1
|
|
|
1
|
|
6
|
|
|
1
|
|
|
1
|
|
8
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
31
|
|
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
64
|
|
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package Test::Lives; |
4
|
|
|
|
|
|
|
$Test::Lives::VERSION = '1.002'; |
5
|
|
|
|
|
|
|
# ABSTRACT: decorate tests with a no-exceptions assertion |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
7
|
use Test::Builder (); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
246
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
my $Tester = Test::Builder->new; |
10
|
|
|
|
|
|
|
*Level = \$Test::Builder::Level; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub lives_and (&;$) { |
13
|
3
|
|
|
3
|
0
|
10290
|
my ( $code, $name ) = @_; |
14
|
|
|
|
|
|
|
|
15
|
3
|
|
|
|
|
13
|
local our $Level = $Level + 1; # this function |
16
|
|
|
|
|
|
|
|
17
|
3
|
|
|
|
|
9
|
my $ok; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
eval { |
20
|
3
|
|
|
|
|
10
|
local $Level = $Level + 2; # eval block + callback |
21
|
3
|
|
|
|
|
14
|
local $Carp::Internal{(__PACKAGE__)} = 1; |
22
|
3
|
|
|
|
|
17
|
$ok = $code->() for $name; |
23
|
2
|
|
|
|
|
3341
|
1; |
24
|
3
|
100
|
|
|
|
7
|
} or do { |
25
|
1
|
|
|
|
|
18
|
my $e = "$@"; |
26
|
1
|
|
|
|
|
8
|
$ok = $Tester->ok( 0, $name ); |
27
|
1
|
|
|
|
|
1498
|
$Tester->diag( $e ); |
28
|
|
|
|
|
|
|
}; |
29
|
|
|
|
|
|
|
|
30
|
3
|
|
|
|
|
357
|
return $ok; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub import { |
34
|
1
|
|
|
1
|
|
9
|
my $class = shift; |
35
|
1
|
0
|
|
|
|
5
|
do { die "Unknown symbol: $_" if $_ ne 'lives_and' } for @_; |
|
0
|
|
|
|
|
0
|
|
36
|
1
|
|
|
1
|
|
9
|
no strict 'refs'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
83
|
|
37
|
1
|
|
|
|
|
11
|
*{ caller . '::lives_and' } = \&lives_and; |
|
1
|
|
|
|
|
1360
|
|
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
1; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
__END__ |