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   379 use base qw/RandomFileMethodBase/;
  1         3  
  1         66  
4 1     1   6 use TestConstants;
  1         2  
  1         121  
5              
6 1     1   7 use Test::More;
  1         2  
  1         6  
7              
8 1     1   203 use File::Random;
  1         2  
  1         242  
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 1120 my ($self, @args) = @_;
14 500         1005 my $content = scalar $self->content_of_random_file(@args);
15 500         4025 $content =~ s/\s*$//s; # ignore whitespaces at the end of the files
16 500         3601 return $content;
17             }
18              
19             sub content_of_random_file_in_scalar_context : Test(2) {
20 1     1 0 2912 my $self = shift;
21 1     5000   8 my @arg = (-check => sub { ! /CVS/ }); # Ignore files in CVS directories
  5000         21739  
22 1         13 $self->expected_files_found_ok( [SIMPLE_CONTENTS()],
23             [@arg, -dir => SIMPLE_DIR],
24             "Simple Contents in scalar context" );
25 1         671 $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         1  
  1         6  
29              
30             1;