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   9 use base qw/RandomFileMethodBase/;
  1         1  
  1         65  
4 1     1   7 use TestConstants;
  1         2  
  1         65  
5              
6 1     1   5 use strict;
  1         2  
  1         31  
7 1     1   6 use warnings;
  1         1  
  1         24  
8              
9 1     1   5 use Test::More;
  1         1  
  1         6  
10              
11             sub check_routine_gets_paths : Test(2) {
12 6     6 0 4402 my $self = shift;
13 6         15 my @files_shift = ();
14 6         15 my @files_it = ();
15 6         27 my %files = ('with shift' => \@files_shift,
16             'with $_' => \@files_it);
17             my %check_routine = (
18 18000     18000   71812 'with shift' => sub { push @files_shift, shift() },
19 18000     18000   69637 'with $_' => sub { push @files_it, $_ }
20 6         45 );
21 6         42 while (my ($check_desc, $check_func) = each %check_routine) {
22 12         4325 my @args = (-dir => REC_DIR,
23             -recursive => 1,
24             -check => $check_func);
25 12         78 my $exp = Set::Scalar->new();
26 12         1032 $exp->insert( $self->random_file(@args) ) for (1 .. SAMPLE_SIZE);
27 12         769 my $found_files = Set::Scalar->new( @{$files{$check_desc}} );
  12         667  
28            
29 12         154616 is $found_files, $exp, "Arguments passed to check $check_desc";
30             }
31 1     1   515 }
  1         2  
  1         6  
32              
33             1;