File Coverage

blib/lib/Test2/Plugin/BailOnFail.pm
Criterion Covered Total %
statement 14 14 100.0
branch 3 4 75.0
condition n/a
subroutine 5 5 100.0
pod n/a
total 22 23 95.6


line stmt bran cond sub pod time code
1             package Test2::Plugin::BailOnFail;
2 1     1   462 use strict;
  1         2  
  1         30  
3 1     1   5 use warnings;
  1         3  
  1         104  
4              
5             our $VERSION = '0.000155';
6              
7 1     1   7 use Test2::API qw/test2_add_callback_context_release/;
  1         3  
  1         144  
8              
9             my $LOADED = 0;
10             sub import {
11 1 50   1   11 return if $LOADED++;
12              
13             test2_add_callback_context_release(sub {
14 9     9   16435 my $ctx = shift;
15 9 100       26 return if $ctx->hub->is_passing;
16 2         30 $ctx->bail("(Bail On Fail)");
17 1         7 });
18             }
19              
20             1;
21              
22             __END__