File Coverage

test/lib/RandomFilePassesPathsToCheckRoutine.pm
Criterion Covered Total %
statement 32 32 100.0
branch n/a
condition n/a
subroutine 9 9 100.0
pod 0 1 0.0
total 41 42 97.6


line stmt bran cond sub pod time code
1             package
2             RandomFilePassesPathsToCheckRoutine;
3 1     1   8 use base qw/RandomFileMethodBase/;
  1         2  
  1         69  
4 1     1   6 use TestConstants;
  1         3  
  1         68  
5              
6 1     1   6 use strict;
  1         1  
  1         36  
7 1     1   7 use warnings;
  1         1  
  1         32  
8              
9 1     1   6 use Test::More;
  1         2  
  1         9  
10              
11             sub check_routine_gets_paths : Test(2) {
12 6     6 0 4526 my $self = shift;
13 6         18 my @files_shift = ();
14 6         16 my @files_it = ();
15 6         33 my %files = ('with shift' => \@files_shift,
16             'with $_' => \@files_it);
17             my %check_routine = (
18 18000     18000   66091 'with shift' => sub { push @files_shift, shift() },
19 18000     18000   65440 'with $_' => sub { push @files_it, $_ }
20 6         49 );
21 6         60 while (my ($check_desc, $check_func) = each %check_routine) {
22 12         3991 my @args = (-dir => REC_DIR,
23             -recursive => 1,
24             -check => $check_func);
25 12         80 my $exp = Set::Scalar->new();
26 12         1105 $exp->insert( $self->random_file(@args) ) for (1 .. SAMPLE_SIZE);
27 12         809 my $found_files = Set::Scalar->new( @{$files{$check_desc}} );
  12         611  
28            
29 12         146089 is $found_files, $exp, "Arguments passed to check $check_desc";
30             }
31 1     1   597 }
  1         2  
  1         6  
32              
33             1;