File Coverage

blib/lib/Test2/Plugin/DBBreak.pm
Criterion Covered Total %
statement 21 21 100.0
branch 4 4 100.0
condition n/a
subroutine 7 7 100.0
pod 0 1 0.0
total 32 33 96.9


line stmt bran cond sub pod time code
1             package Test2::Plugin::DBBreak;
2 4     4   961838 use strict;
  4         8  
  4         301  
3 4     4   29 use warnings;
  4         7  
  4         537  
4              
5             our $VERSION = '0.200000';
6              
7             our $disable = 0;
8              
9 4         1127 use Test2::API qw{
10             test2_add_callback_post_load
11             test2_stack
12 4     4   33 };
  4         26  
13              
14             sub import {
15 4     4   78 my $class = shift;
16 4         12 my %params = @_;
17              
18             test2_add_callback_post_load(
19             sub {
20 4     4   4636592 my $hub = test2_stack()->top;
21 4         127 $hub->listen(\&listener, inherit => 1);
22             }
23 4         48 );
24             }
25              
26             sub listener {
27 16     16 0 4368812 my ($hub, $event) = @_;
28 4     4   32 no warnings 'once';
  4         11  
  4         687  
29              
30 16 100       71 return if ($disable);
31              
32 15 100       184 $DB::single = 1 if ($event->causes_fail);
33              
34 15         621 return;
35             }
36              
37             1;
38              
39             __END__