Getopt-Compact-WithCmd
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
t/private/parse_argv.t view on Meta::CPAN
my $go = Getopt::Compact::WithCmd->new;
sub test_parse_argv {
my %specs = @_;
my ($input, $expects, $sub_command, $desc) =
@specs{qw/input expects sub_command desc/};
subtest $desc => sub {
local @ARGV = @$input;
$go->{_struct} = $sub_command || {};
my @opts = $go->_parse_argv;
is_deeply \@opts, $expects, 'parse argv';
done_testing;
};
};
test_parse_argv(
t/private/parse_command_struct.t view on Meta::CPAN
use Test::More;
use Getopt::Compact::WithCmd;
sub test_parse_command_struct {
my %specs = @_;
my ($struct, $expects, $args, $opts, $extra_test, $has_error, $desc) =
@specs{qw/struct expects args opts extra_test has_error desc/};
subtest $desc => sub {
local @ARGV = @$args if $args;
my $go = bless {
$opts ? %$opts : (),
_struct => $struct,
}, 'Getopt::Compact::WithCmd';
my $got = $go->_parse_command_struct($struct);
is +$got->{ret}, $expects->{ret}, 'ret value';
is +$got->{command}, $expects->{command}, 'command';
is_deeply +$got->{commands}, $expects->{commands}, 'commands';
view all matches for this distributionview release on metacpan - search on metacpan
( run in 1.210 second using v1.00-cache-2.02-grep-82fe00e-cpan-c9a218a2bbc )