Perl5-TestEachCommit

 view release on metacpan or  search on metacpan

lib/Perl5/TestEachCommit/Util.pm  view on Meta::CPAN

Process command-line switches (options).  Returns a reference to a hash.

B<Note:> This function is little more than a wrapper around
C<Getopt::Long::GetOptions()>.  As such, it performs no evaluation of any
interactions among the various command-line switches.  That evaluation is
deferred until C<Perl5::TestEachCommit::new() is called.

=cut

sub process_command_line {
    local @ARGV = @ARGV;

    my %opts = map { $_ => '' } ( qw|
        workdir
        branch
        start
        end
        configure_command
        make_test_prep_command
        make_test_harness_command
        skip_test_harness

t/02-util.t  view on Meta::CPAN

$make_test_prep_command     = 'make test_prep';
$make_test_harness_command  = 'make test_harness';
$skip_test_harness = '';
$make_minitest_prep_command = 'make minitest_prep';
$make_minitest_command      = 'make minitest';

note("Typical case: make test_prep and make harness");

{
    note("Calling neither 'verbose' nor 'skip_test_harness'");
    local @ARGV = (
        '--workdir'     => $workdir,
        '--branch'      => $branch,
        '--start'       => $start,
        '--end'         => $end,
        #    '--verbose'     => $verbose,
        '--configure_command'       => $configure_command,
        '--make_test_prep_command'  => $make_test_prep_command,
        '--make_test_harness_command'   => $make_test_harness_command,
        #'--skip_test_harness' => $skip_test_harness,
    );

t/02-util.t  view on Meta::CPAN

    is($opts->{make_test_prep_command}, $make_test_prep_command,
        "Got expected make_test_prep_command");
    is($opts->{make_test_harness_command}, $make_test_harness_command,
        "Got expected make_test_harness_command");
    ok(! $opts->{skip_test_harness}, "skip_test_harness not selected");
}

{
    note("Calling both 'verbose' and 'skip_test_harness'");
    my ($skip_test_harness, $verbose) = (undef) x 2;
    local @ARGV = (
        '--workdir'     => $workdir,
        '--branch'      => $branch,
        '--start'       => $start,
        '--end'         => $end,
        '--verbose'     => $verbose,
        '--configure_command'       => $configure_command,
        '--make_test_prep_command'  => $make_test_prep_command,
        '--make_test_harness_command'   => $make_test_harness_command,
        '--skip_test_harness' => $skip_test_harness,
    );

t/02-util.t  view on Meta::CPAN

    is($opts->{make_test_prep_command}, $make_test_prep_command,
        "Got expected make_test_prep_command");
    is($opts->{make_test_harness_command}, $make_test_harness_command,
        "Got expected make_test_harness_command");
    ok($opts->{skip_test_harness}, "skip_test_harness selected");
}

note("Mini case: make minitest_prep and make minitest");

{
    local @ARGV = (
        '--workdir'     => $workdir,
        '--branch'      => $branch,
        '--start'       => $start,
        '--end'         => $end,
        #    '--verbose'     => $verbose,
        '--configure_command'           => $configure_command,
        '--make_minitest_prep_command'  => $make_minitest_prep_command,
        '--make_minitest_command'       => $make_minitest_command,
    );



( run in 0.219 second using v1.01-cache-2.11-cpan-9383018d099 )