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