File Coverage

blib/lib/Perl5/TestEachCommit/Util.pm
Criterion Covered Total %
statement 25 25 100.0
branch 1 2 50.0
condition n/a
subroutine 8 8 100.0
pod 1 1 100.0
total 35 36 97.2


line stmt bran cond sub pod time code
1             package Perl5::TestEachCommit::Util;
2 1     1   6305 use 5.014;
  1         4  
3 1     1   6 use Exporter 'import';
  1         2  
  1         83  
4 1     1   10 use Carp;
  1         2  
  1         93  
5 1     1   7 use File::Spec;
  1         2  
  1         39  
6 1     1   5 use File::Spec::Unix;
  1         2  
  1         40  
7 1     1   952 use Getopt::Long;
  1         19492  
  1         7  
8 1     1   842 use locale; # make \w work right in non-ASCII lands
  1         931  
  1         8  
9              
10             our $VERSION = 0.07; # Please keep in synch with lib/Perl5/TestEachCommit.pm
11             $VERSION = eval $VERSION;
12             our @EXPORT_OK = qw( process_command_line );
13              
14             =head1 NAME
15              
16             Perl5::TestEachCommit::Util - helper functions for Perl5::TestEachCommit
17              
18             =head1 SUBROUTINES
19              
20             =head2 C
21              
22             Process command-line switches (options). Returns a reference to a hash.
23              
24             B This function is little more than a wrapper around
25             C. As such, it performs no evaluation of any
26             interactions among the various command-line switches. That evaluation is
27             deferred until C
28              
29             =cut
30              
31             sub process_command_line {
32 3     3 1 358587 local @ARGV = @ARGV;
33              
34 3         12 my %opts = map { $_ => '' } ( qw|
  33         98  
35             workdir
36             branch
37             start
38             end
39             configure_command
40             make_test_prep_command
41             make_test_harness_command
42             skip_test_harness
43             verbose
44             make_minitest_prep_command
45             make_minitest_command
46             | );
47              
48             my $result = GetOptions(
49             "workdir=s" => \$opts{workdir},
50             "branch=s" => \$opts{branch},
51             "start=s" => \$opts{start},
52             "end=s" => \$opts{end},
53             "configure_command=s" => \$opts{configure_command},
54             "make_test_prep_command=s" => \$opts{make_test_prep_command},
55             "make_test_harness_command=s" => \$opts{make_test_harness_command},
56             "skip_test_harness" => \$opts{skip_test_harness},
57             "verbose" => \$opts{verbose},
58             "make_minitest_prep_command=s" => \$opts{make_minitest_prep_command},
59             "make_minitest_command=s" => \$opts{make_minitest_command},
60 3 50       36 ) or croak "Error in command line arguments";
61              
62 3         6820 return \%opts;
63             }
64              
65             1;
66