File Coverage

inc/My/Module/Test.pm
Criterion Covered Total %
statement 1 30 3.3
branch n/a
condition n/a
subroutine 10 10 100.0
pod 1 2 50.0
total 12 42 28.5


line stmt bran cond sub pod time code
1             package My::Module::Test;
2              
3 0     6   0 use 5.008001;
  0         0  
4              
5 0     6   0 use strict;
  0         0  
  0         0  
6 0     6   0 use warnings;
  0         0  
  0         0  
7              
8 0     6   0 use Carp qw{ croak };
  0         0  
  0         0  
9 0     6   0 use Exporter qw{ import };
  0         0  
  0         0  
10 0     6   0 use Test2::V0;
  0         0  
  0         0  
11 0     6   0 use Test2::Util qw{ pkg_to_file };
  0         0  
  0         0  
12              
13             our $VERSION = '0.007_01';
14              
15             our @EXPORT_OK = qw{
16             build_skip_reason
17             cant_locate
18             CHECK_MISSING_INFO
19             $LOAD_ERROR_TEMPLATE
20             };
21              
22             # NOTE that if there are no diagnostics, info() returns undef, not an
23             # empty array. I find this nowhere documented, so I am checking for
24             # both.
25 4     6   553 use constant CHECK_MISSING_INFO => in_set( undef, array{ end; } );
  0         0  
  0         0  
  0         0  
26              
27             {
28             # We jump through these hoops because we do not want to have the
29             # test routines assume that the module under test can be loaded.
30              
31             my $code = eval {
32             require Test2::Tools::LoadModule;
33             Test2::Tools::LoadModule->can( '__build_load_eval' );
34             };
35              
36             sub build_skip_reason {
37 0     7 0 0 my @arg = @_;
38 0         0 return sprintf 'Unable to %s', $code->( @arg );
39             }
40             }
41              
42             our $LOAD_ERROR_TEMPLATE = '%s';
43              
44             sub cant_locate {
45 0     4 1 0 my ( $module ) = @_;
46 0         0 my $fn = pkg_to_file( $module );
47 0         0 my $msg = sprintf $LOAD_ERROR_TEMPLATE, "Can't locate $fn in \@INC";
48 0         0 return match qr/ \A \Q$msg\E \b /smx;
49             }
50              
51             1;
52              
53             __END__