File Coverage

test/lib/RandomFileMethodAllTests.pm
Criterion Covered Total %
statement 30 30 100.0
branch 2 2 100.0
condition 4 6 66.6
subroutine 8 8 100.0
pod 1 3 33.3
total 45 49 91.8


line stmt bran cond sub pod time code
1             package
2             RandomFileMethodAllTests;
3 1         410 use base qw/RandomFileSimpleDirOption
4             RandomFileCheckOption
5             RandomFileRecursiveOption
6             RandomFilePassesPathsToCheckRoutine
7 1     1   515 RandomFileWithUnknownParameters/;
  1         2  
8            
9 1     1   8 use strict;
  1         2  
  1         22  
10 1     1   5 use warnings;
  1         2  
  1         22  
11              
12 1     1   5 use Test::More;
  1         2  
  1         4  
13              
14 1         322 use constant ALIASES =>({},
15             {-dir => '-d', -recursive => '-r', -check => '-c'},
16 1     1   235 {-dir => '-directory', '-recursive' => '-rec'});
  1         1  
17              
18             my %current_aliases;
19              
20             sub random_file {
21 18060     18060 0 130027 my ($self, %args) = @_;
22 18060         21772 my %alias_args;
23 18060         47429 while (my ($option, $value) = each %args) {
24 30828   66     114205 $alias_args{ $current_aliases{$option} || $option } = $value;
25             }
26 18060         43661 return $self->SUPER::random_file(%alias_args);
27             }
28              
29             sub content_of_random_file {
30 18060     18060 0 42278 my ($self, %args) = @_;
31 18060         23442 my %alias_args;
32 18060         50913 while (my ($option, $value) = each %args) {
33 43620   66     166456 $alias_args{ $current_aliases{$option} || $option } = $value;
34             }
35 18060         48726 return $self->SUPER::content_of_random_file(%alias_args);
36             }
37              
38             # Quite a dirty trick to overwrite runtests
39             # but I want to run all tests for every alias one time
40             #
41             # If you know something better, please email me
42             sub runtests {
43 2     2 1 3942 my $self = shift;
44 2         9 foreach (ALIASES) {
45 6         5101 %current_aliases = %$_;
46 6 100       39 diag("Test aliases: ", %current_aliases) if %current_aliases;
47 6         1722 $self->SUPER::runtests();
48             }
49             }
50              
51             1;