File Coverage

test/lib/ContentOfRandomFileInScalarContext.pm
Criterion Covered Total %
statement 24 24 100.0
branch n/a
condition n/a
subroutine 8 8 100.0
pod 0 2 0.0
total 32 34 94.1


line stmt bran cond sub pod time code
1             package ContentOfRandomFileInScalarContext;
2 1     1   412 use base qw/RandomFileMethodBase/;
  1         2  
  1         68  
3 1     1   6 use TestConstants;
  1         1  
  1         74  
4              
5 1     1   8 use Test::More;
  1         2  
  1         5  
6              
7 1     1   221 use File::Random;
  1         3  
  1         232  
8              
9             # Change the random_file call to simply return the Contents
10             # Could be danger to overwrite this changed version !!
11             sub random_file {
12 500     500 0 1138 my ($self, @args) = @_;
13 500         1009 my $content = scalar $self->content_of_random_file(@args);
14 500         3606 $content =~ s/\s*$//s; # ignore whitespaces at the end of the files
15 500         3727 return $content;
16             }
17              
18             sub content_of_random_file_in_scalar_context : Test(2) {
19 1     1 0 2413 my $self = shift;
20 1     5000   6 my @arg = (-check => sub { ! /CVS/ }); # Ignore files in CVS directories
  5000         19549  
21 1         14 $self->expected_files_found_ok( [SIMPLE_CONTENTS()],
22             [@arg, -dir => SIMPLE_DIR],
23             "Simple Contents in scalar context" );
24 1         624 $self->expected_files_found_ok( [REC_CONTENTS()],
25             [@arg, -dir => REC_DIR, -recursive => 1],
26             "Recursive Contents in scalar context" );
27 1     1   31 }
  1         2  
  1         6  
28              
29             1;