test/lib/ContentOfRandomFileInScalarContext.pm

filter: Statementstmt 100% 25 / 25 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 8 / 8 Podpod 0.0% 0 / 2 totaltotal 94.2% 33 / 35 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« test/lib/RandomFileWithUnknownParameters.pm ↑ Summary test/lib/TestConstants.pm »
1 package ContentOfRandomFileInScalarContext;
2 1 ▶use base qw/RandomFileMethodBase/;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use TestConstants;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 ▶use Test::More;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 ▶use File::Random;
Subroutine BEGIN: called CC=1 SCAR=0.0
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 ▶ my ($self, @args) = @_;
Subroutine random_file: called CC=1 SCAR=0.0
Pod undocumented
13 500 my $content = scalar $self->content_of_random_file(@args);
14 500 $content =~ s/\s*$//s; # ignore whitespaces at the end of the files
15 500 return $content;
16 }
17  
18 sub content_of_random_file_in_scalar_context : Test(2) {
19 1 ▶ my $self = shift;
Subroutine content_of_random_file_in_scalar_context: called CC=1 SCAR=0.0
Pod undocumented
20 1 ▶ my @arg = (-check => sub { ! /CVS/ }); # Ignore files in CVS directories
Subroutine __ANON__: called CC=1 SCAR=0.0
21 1 $self->expected_files_found_ok( [SIMPLE_CONTENTS()],
22 [@arg, -dir => SIMPLE_DIR],
23 "Simple Contents in scalar context" );
24 1 $self->expected_files_found_ok( [REC_CONTENTS()],
25 [@arg, -dir => REC_DIR, -recursive => 1],
26 "Recursive Contents in scalar context" );
27 1 ▶}
Subroutine BEGIN: called CC=1 SCAR=0.0
28  
29 1 1;
« test/lib/RandomFileWithUnknownParameters.pm ↑ Summary test/lib/TestConstants.pm »