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