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
2             ContentOfRandomFileInScalarContext;
3 1     1   411 use base qw/RandomFileMethodBase/;
  1         3  
  1         70  
4 1     1   7 use TestConstants;
  1         2  
  1         76  
5              
6 1     1   6 use Test::More;
  1         2  
  1         8  
7              
8 1     1   253 use File::Random;
  1         2  
  1         248  
9              
10             # Change the random_file call to simply return the Contents
11             # Could be danger to overwrite this changed version !!
12             sub random_file {
13 500     500 0 1111 my ($self, @args) = @_;
14 500         1048 my $content = scalar $self->content_of_random_file(@args);
15 500         3639 $content =~ s/\s*$//s; # ignore whitespaces at the end of the files
16 500         3620 return $content;
17             }
18              
19             sub content_of_random_file_in_scalar_context : Test(2) {
20 1     1 0 2526 my $self = shift;
21 1     5000   8 my @arg = (-check => sub { ! /CVS/ }); # Ignore files in CVS directories
  5000         20592  
22 1         14 $self->expected_files_found_ok( [SIMPLE_CONTENTS()],
23             [@arg, -dir => SIMPLE_DIR],
24             "Simple Contents in scalar context" );
25 1         764 $self->expected_files_found_ok( [REC_CONTENTS()],
26             [@arg, -dir => REC_DIR, -recursive => 1],
27             "Recursive Contents in scalar context" );
28 1     1   9 }
  1         2  
  1         17  
29              
30             1;