line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Exec; |
2
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
786681
|
use strict; |
|
5
|
|
|
|
|
37
|
|
|
5
|
|
|
|
|
144
|
|
4
|
5
|
|
|
5
|
|
36
|
use warnings; |
|
5
|
|
|
|
|
19
|
|
|
5
|
|
|
|
|
117
|
|
5
|
5
|
|
|
5
|
|
161
|
use 5.010; |
|
5
|
|
|
|
|
17
|
|
6
|
5
|
|
|
5
|
|
26
|
use Test2::API qw( context ); |
|
5
|
|
|
|
|
13
|
|
|
5
|
|
|
|
|
271
|
|
7
|
5
|
|
|
5
|
|
1950
|
use Test2::Tools::Process (); |
|
5
|
|
|
|
|
14
|
|
|
5
|
|
|
|
|
154
|
|
8
|
5
|
|
|
5
|
|
34
|
use Return::MultiLevel qw( with_return ); |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
232
|
|
9
|
5
|
|
|
5
|
|
32
|
use base 'Exporter'; |
|
5
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
1823
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# ABSTRACT: Test that some code calls exec without terminating testing |
12
|
|
|
|
|
|
|
our $VERSION = '0.07'; # VERSION |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our @EXPORT = qw( exec_arrayref never_exec_ok ); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
my $last; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub exec_arrayref(&) |
21
|
|
|
|
|
|
|
{ |
22
|
10
|
|
|
10
|
1
|
9312
|
my($code) = @_; |
23
|
|
|
|
|
|
|
|
24
|
10
|
|
|
|
|
22
|
undef $last; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
return with_return { |
27
|
10
|
|
|
10
|
|
165
|
my($return) = @_; |
28
|
|
|
|
|
|
|
local $Test2::Tools::Process::handlers{exec} = sub { |
29
|
6
|
|
|
|
|
49
|
$last = [caller(1)]; |
30
|
6
|
|
|
|
|
28
|
$return->([@_]); |
31
|
10
|
|
|
|
|
107
|
}; |
32
|
10
|
|
|
|
|
37
|
$code->(); |
33
|
4
|
|
|
|
|
816
|
undef; |
34
|
10
|
|
|
|
|
59
|
}; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub never_exec_ok (&;$) |
39
|
|
|
|
|
|
|
{ |
40
|
3
|
|
|
3
|
1
|
47023
|
my($code, $name) = @_; |
41
|
|
|
|
|
|
|
|
42
|
3
|
|
100
|
|
|
16
|
$name ||= 'does not call exec'; |
43
|
|
|
|
|
|
|
|
44
|
3
|
|
|
3
|
|
14
|
my $ret = exec_arrayref { $code->() }; |
|
3
|
|
|
|
|
10
|
|
45
|
3
|
|
|
|
|
31
|
my $ok = !defined $ret; |
46
|
|
|
|
|
|
|
|
47
|
3
|
|
|
|
|
9
|
my $ctx = context(); |
48
|
3
|
|
|
|
|
264
|
$ctx->ok($ok, $name); |
49
|
|
|
|
|
|
|
|
50
|
3
|
100
|
66
|
|
|
580
|
if(!$ok && $last) |
51
|
|
|
|
|
|
|
{ |
52
|
1
|
|
|
|
|
4
|
my(undef, $filename, $line) = @$last; |
53
|
1
|
|
|
|
|
6
|
$ctx->diag("exec at $filename line $line"); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
3
|
|
|
|
|
185
|
$ctx->release; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
1; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
__END__ |