File Coverage

inc/Test/LoadAllModules.pm
Criterion Covered Total %
statement 90 93 96.7
branch 3 8 37.5
condition n/a
subroutine 22 23 95.6
pod 1 2 50.0
total 116 126 92.0


line stmt bran cond sub pod time code
1             #line 1
2 1     1   476 package Test::LoadAllModules;
  1         2  
  1         27  
3 1     1   5 use strict;
  1         2  
  1         23  
4 1     1   490 use warnings;
  1         3  
  1         35  
5 1     1   422 use Module::Pluggable::Object;
  1         3  
  1         5  
6 1     1   482 use List::MoreUtils qw(any);
  1         3  
  1         41  
7             use Test::More ();
8              
9             our $VERSION = '0.022';
10 1     1   7  
  1         1  
  1         329  
11             use Exporter;
12             our @ISA = qw/Exporter/;
13             our @EXPORT = qw/all_uses_ok/;
14              
15 1     1 1 70 sub all_uses_ok {
16 1         2 my %param = @_;
17 1 50       4 my $search_path = $param{search_path};
18 0         0 unless ($search_path) {
19 0         0 Test::More::plan skip_all => 'no search path';
20             exit;
21 1         4 }
22 1 50       2 Test::More::plan('no_plan');
  1         6  
23             my @exceptions = @{ $param{except} || [] };
24 1 50       3 my @lib
  1         5  
25 1         2 = @{ $param{lib} || [ 'lib' ] };
26 14         27 foreach my $class (
27             grep { !is_excluded( $_, @exceptions ) }
28 1         3 sort do {
29 1         9 local @INC = @lib;
30             my $finder = Module::Pluggable::Object->new(
31 1         3 search_path => $search_path );
32             ( $search_path, $finder->plugins );
33             }
34             )
35 1     1   459 {
  1     1   4  
  1     1   4  
  1     1   22  
  1     1   9  
  1     1   2  
  1     1   2  
  1     1   17  
  1     1   8  
  1     1   3  
  1     1   2  
  1     1   14  
  1     1   8  
  1     1   2  
  1         2  
  1         11  
  1         538  
  1         5  
  1         4  
  1         20  
  1         446  
  1         2  
  1         2  
  1         19  
  1         444  
  1         2  
  1         2  
  1         21  
  1         448  
  1         3  
  1         4  
  1         20  
  1         433  
  1         2  
  1         2  
  1         18  
  1         470  
  1         4  
  1         2  
  1         21  
  1         6  
  1         4  
  1         2  
  1         15  
  1         8  
  1         4  
  1         2  
  1         16  
  1         447  
  1         2  
  1         4  
  1         20  
  1         7  
  1         5  
  1         2  
  1         15  
  14         37  
36             Test::More::use_ok($class);
37             }
38             }
39              
40 14     14 0 22 sub is_excluded {
41 14 0   0   76 my ( $module, @exceptions ) = @_;
  0            
42             any { $module eq $_ || $module =~ /$_/ } @exceptions;
43             }
44              
45             1;
46              
47             __END__