test/lib/RandomFileCheckOption.pm

filter: Statementstmt 100% 46 / 46 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 15 / 15 Podpod 0.0% 0 / 2 totaltotal 96.8% 61 / 63 SCAR 13.9
CC
4
Cov
100%
check_standard_case
3.0
wrong_check_params
2.0
BEGIN
1.0
CRAP 4.0
« test/lib/RandomFileSimpleDirOption.pm ↑ Summary test/lib/RandomFileRecursiveOption.pm »
1 package RandomFileCheckOption;
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 strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 ▶use Test::More;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use Test::Exception;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use Data::Dumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 1 use constant FILES_FOR_RE => (qr/\d$/ => [ SIMPLE_FILES_WITH_NR ],
13 1 ▶ qr/\./ => [ SIMPLE_FILES_WITH_DOT ]);
Subroutine BEGIN: called CC=1 SCAR=0.0
14 1 ▶use constant WRONG_CHECK_PARAMS => (undef, '', '/./', {}, [], 0);
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 sub check_standard_case : Test(4) {
17 6 ▶ my $self = shift;
Subroutine check_standard_case: called CC=3 SCAR=11.0
Pod undocumented
18 6 my %files = FILES_FOR_RE;
19 6 foreach my $re (keys %files) {
20 12 ▶ foreach my $check (qr/$re/, sub {/$re/}) {
Subroutine __ANON__: called CC=1 SCAR=0.0
21 24 my @args = (-dir => SIMPLE_DIR, -check => $check);
22 24 $self->expected_files_found_ok($files{$re},
23 [@args],
24 "Used RE $re as " . ref $check);
25 }
26 }
27 1 ▶}
Subroutine BEGIN: called CC=1 SCAR=0.0
28  
29 sub wrong_check_params : Test(6) {
30 6 ▶ my $self = shift;
Subroutine wrong_check_params: called CC=2 SCAR=6.9
Pod undocumented
31 6 foreach (WRONG_CHECK_PARAMS) {
32 36 my @args = (-dir => SIMPLE_DIR, -check => $_);
33 36 ▶ dies_ok( sub {$self->random_file(@args)},
Subroutine __ANON__: called CC=1 SCAR=0.0
34 36 "expected to die with Args " . Dumper(\@args) );
35
36 }
37 1 ▶}
Subroutine BEGIN: called CC=1 SCAR=0.0
38  
39 1 1;
« test/lib/RandomFileSimpleDirOption.pm ↑ Summary test/lib/RandomFileRecursiveOption.pm »