test/lib/RandomFileSimpleDirOption.pm

filter: Statementstmt 100% 57 / 57 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 20 / 20 Podpod 0.0% 0 / 5 totaltotal 93.9% 77 / 82 SCAR 13.9
CC
4
Cov
100%
dir_option_with_a_simple_dir
2.0
dir_option_for_an_empty_dir
2.0
wrong_dir_parameters
2.0
CRAP 4.0
« test/lib/RandomFileMethodAllTests.pm ↑ Summary test/lib/RandomFileCheckOption.pm »
1 package
2 RandomFileSimpleDirOption;
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 Test::More;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use Test::Exception;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use Data::Dumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 1 use constant SIMPLE_DIR_ARGS => ([-path => SIMPLE_DIR, -home => HOME_DIR],
12 [-dir => no_slash( SIMPLE_DIR)],
13 1 ▶ [-dir => with_slash (SIMPLE_DIR)]);
Subroutine BEGIN: called CC=1 SCAR=0.0
14
15 1 use constant EMPTY_DIR_ARGS => ([-path => EMPTY_DIR, -home => HOME_DIR],
16 [-dir => no_slash (EMPTY_DIR)],
17 1 ▶ [-dir => with_slash (EMPTY_DIR)]);
Subroutine BEGIN: called CC=1 SCAR=0.0
18
19 1 use constant WRONG_DIR_PARAMS => ("/foo/bar/nonsens/reallynonsens/",
20 1 ▶ undef, '', 0, [], {});
Subroutine BEGIN: called CC=1 SCAR=0.0
21  
22 sub create_empty_subdir : Test(setup) {
23 54 ▶ mkdir EMPTY_DIR;
Subroutine create_empty_subdir: called CC=1 SCAR=0.0
Pod undocumented
24 1 ▶}
Subroutine BEGIN: called CC=1 SCAR=0.0
25  
26 sub dir_option_with_a_simple_dir : Test(3) {
27 6 ▶ my $self = shift;
Subroutine dir_option_with_a_simple_dir: called CC=2 SCAR=6.9
Pod undocumented
28 6 foreach (SIMPLE_DIR_ARGS) {
29 18 $self->expected_files_found_ok([ SIMPLE_FILES ],
30 $_,
31 "Simple Dir: Args ". join " ", @$_);
32 }
33 1 ▶}
Subroutine BEGIN: called CC=1 SCAR=0.0
34  
35 sub dir_option_for_an_empty_dir : Test(3) {
36 6 ▶ my $self = shift;
Subroutine dir_option_for_an_empty_dir: called CC=2 SCAR=6.9
Pod undocumented
37 6 foreach (EMPTY_DIR_ARGS) {
38 18 $self->expected_files_found_ok([],
39 $_,
40 "Empty Dir: Argumente " . join " ", @$_);
41 }
42 1 ▶}
Subroutine BEGIN: called CC=1 SCAR=0.0
43  
44 sub samples_arent_same : Test(1) {
45 6 ▶ my ($self) = @_;
Subroutine samples_arent_same: called CC=1 SCAR=0.0
Pod undocumented
46 6 my @arg = (-dir => SIMPLE_DIR);
47 6 ok( ! eq_array( [$self->sample(@arg)], [$self->sample(@arg)] ),
48 "samples are different" );
49 1 ▶}
Subroutine BEGIN: called CC=1 SCAR=0.0
50  
51 sub wrong_dir_parameters : Test(6) {
52 6 ▶ my ($self) = @_;
Subroutine wrong_dir_parameters: called CC=2 SCAR=6.9
Pod undocumented
53 6 foreach my $wrong_dir ( WRONG_DIR_PARAMS() ) {
54 36 ▶ dies_ok( sub {$self->random_file(-dir => $wrong_dir)},
Subroutine __ANON__: called CC=1 SCAR=0.0
55 36 "-dir " . Dumper($wrong_dir) );
56 }
57 1 ▶}
Subroutine BEGIN: called CC=1 SCAR=0.0
58  
59 1 1;
« test/lib/RandomFileMethodAllTests.pm ↑ Summary test/lib/RandomFileCheckOption.pm »