File Coverage

blib/lib/Test/Stream/Plugin/Exception.pm
Criterion Covered Total %
statement 27 27 100.0
branch 4 4 100.0
condition n/a
subroutine 8 8 100.0
pod 2 2 100.0
total 41 41 100.0


line stmt bran cond sub pod time code
1             package Test::Stream::Plugin::Exception;
2 95     95   1062 use strict;
  95         8008  
  95         2487  
3 95     95   485 use warnings;
  95         159  
  95         2581  
4              
5 95     95   475 use Test::Stream::Util qw/try/;
  95         163  
  95         593  
6 95     95   510 use Carp qw/croak/;
  95         159  
  95         5564  
7              
8 95     95   486 use Test::Stream::Exporter;
  95         299  
  95         563  
9             default_exports qw/lives dies/;
10 95     95   485 no Test::Stream::Exporter;
  95         164  
  95         381  
11              
12             sub lives(&) {
13 20     20 1 90 my $code = shift;
14 20         73 my ($ok, $err) = &try($code);
15 20 100       135 return 1 if $ok;
16 2         18 warn $err;
17 2         11 return 0;
18             }
19              
20             sub dies(&) {
21 220     220 1 967 my $code = shift;
22 220         886 my ($ok, $err) = &try($code);
23 220 100       671 return undef if $ok;
24 218         1708 return $err;
25             }
26              
27             1;
28              
29             __END__