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