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 RandomFileMethodAllTests;
2 1         398 use base qw/RandomFileSimpleDirOption
3             RandomFileCheckOption
4             RandomFileRecursiveOption
5             RandomFilePassesPathsToCheckRoutine
6 1     1   596 RandomFileWithUnknownParameters/;
  1         2  
7            
8 1     1   8 use strict;
  1         2  
  1         22  
9 1     1   4 use warnings;
  1         2  
  1         21  
10              
11 1     1   4 use Test::More;
  1         2  
  1         4  
12              
13 1         331 use constant ALIASES =>({},
14             {-dir => '-d', -recursive => '-r', -check => '-c'},
15 1     1   236 {-dir => '-directory', '-recursive' => '-rec'});
  1         1  
16              
17             my %current_aliases;
18              
19             sub random_file {
20 18060     18060 0 125536 my ($self, %args) = @_;
21 18060         22685 my %alias_args;
22 18060         47899 while (my ($option, $value) = each %args) {
23 30828   66     113273 $alias_args{ $current_aliases{$option} || $option } = $value;
24             }
25 18060         45564 return $self->SUPER::random_file(%alias_args);
26             }
27              
28             sub content_of_random_file {
29 18060     18060 0 43400 my ($self, %args) = @_;
30 18060         23853 my %alias_args;
31 18060         51974 while (my ($option, $value) = each %args) {
32 43620   66     159773 $alias_args{ $current_aliases{$option} || $option } = $value;
33             }
34 18060         52702 return $self->SUPER::content_of_random_file(%alias_args);
35             }
36              
37             # Quite a dirty trick to overwrite runtests
38             # but I want to run all tests for every alias one time
39             #
40             # If you know something better, please email me
41             sub runtests {
42 2     2 1 3768 my $self = shift;
43 2         8 foreach (ALIASES) {
44 6         5232 %current_aliases = %$_;
45 6 100       40 diag("Test aliases: ", %current_aliases) if %current_aliases;
46 6         1623 $self->SUPER::runtests();
47             }
48             }
49              
50             1;