Module-Setup

 view release on metacpan or  search on metacpan

t/010_core/setup_options.t  view on Meta::CPAN

use Module::Setup::Test::Utils;
use Test::Base;

plan tests => 2 * blocks;

filters { input => [qw/lines chomp/], argv => [qw/lines chomp array/], options => 'yaml' };

run {
    my $block = shift;

    local @ARGV = $block->input;
    my $self = Module::Setup->new->setup_options;
    my $options = {
        target             => undef,
        plugins            => undef,
        direct             => undef,
        module_setup_dir   => undef,
        flavor_class       => undef,
        pack               => undef,
        flavor             => undef,
        init               => undef,
        additional         => undef,
        without_additional => undef,
        executable         => undef,
        devel              => undef,
        test               => undef,
        %{ $block->options || {} },
    };

    is_deeply $self->{argv}, $block->argv;
    is_deeply $self->{options}, $options;
};

__END__

===
--- input
Foo
--- argv
Foo
--- options

===
--- input
Foo default
--- argv
Foo default
--- options

===
--- input
--init
--- argv
--- options
init: 1

===
--- input
--init
--flavor-class=+Foo
--- argv
--- options
init: 1
flavor_class: +Foo

===
--- input
--init
--flavour-class=+Foo
--- argv
--- options



( run in 0.885 second using v1.01-cache-2.11-cpan-39bf76dae61 )