line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test2::Plugin::ExitSummary; |
2
|
160
|
|
|
160
|
|
1639
|
use strict; |
|
160
|
|
|
|
|
342
|
|
|
160
|
|
|
|
|
4592
|
|
3
|
160
|
|
|
160
|
|
816
|
use warnings; |
|
160
|
|
|
|
|
425
|
|
|
160
|
|
|
|
|
6692
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.000155'; |
6
|
|
|
|
|
|
|
|
7
|
160
|
|
|
160
|
|
2762
|
use Test2::API qw/test2_add_callback_exit/; |
|
160
|
|
|
|
|
225048
|
|
|
160
|
|
|
|
|
49728
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
my $ADDED_HOOK = 0; |
10
|
162
|
100
|
|
162
|
|
3705
|
sub import { test2_add_callback_exit(\&summary) unless $ADDED_HOOK++ } |
11
|
|
|
|
|
|
|
|
12
|
4
|
|
|
4
|
0
|
85
|
sub active { $ADDED_HOOK } |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub summary { |
15
|
111
|
|
|
111
|
0
|
120196
|
my ($ctx, $real, $new) = @_; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# Avoid double-printing diagnostics if Test::Builder already loaded. |
18
|
111
|
100
|
|
|
|
689
|
return if $INC{'Test/Builder.pm'}; |
19
|
|
|
|
|
|
|
|
20
|
110
|
|
|
|
|
594
|
my $hub = $ctx->hub; |
21
|
110
|
|
|
|
|
856
|
my $plan = $hub->plan; |
22
|
110
|
|
|
|
|
3121
|
my $count = $hub->count; |
23
|
110
|
|
|
|
|
959
|
my $failed = $hub->failed; |
24
|
|
|
|
|
|
|
|
25
|
110
|
100
|
100
|
|
|
923
|
$ctx->diag('No tests run!') if !$count && (!$plan || $plan ne 'SKIP'); |
|
|
|
100
|
|
|
|
|
26
|
110
|
100
|
100
|
|
|
1588
|
$ctx->diag('Tests were run but no plan was declared and done_testing() was not seen.') |
27
|
|
|
|
|
|
|
if $count && !$plan; |
28
|
|
|
|
|
|
|
|
29
|
110
|
100
|
|
|
|
992
|
$ctx->diag("Looks like your test exited with $real after test #$count.") |
30
|
|
|
|
|
|
|
if $real; |
31
|
|
|
|
|
|
|
|
32
|
110
|
100
|
100
|
|
|
2797
|
$ctx->diag("Did not follow plan: expected $plan, ran $count.") |
|
|
|
66
|
|
|
|
|
|
|
|
100
|
|
|
|
|
33
|
|
|
|
|
|
|
if $plan && $plan =~ m/^[0-9]+$/ && defined $count && $count != $plan; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
1; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
__END__ |