MooX-Options

 view release on metacpan or  search on metacpan

t/15-multiple-split-options.t  view on Meta::CPAN

#!perl
use strict;
use warnings all => 'FATAL';
use Test::More;

BEGIN {
    use Module::Runtime qw(use_module);
    eval { use_module("Data::Record"); use_module("Regexp::Common"); }
        or plan skip_all => "This test needs Data::Record and Regexp::Common";
}

{

    package TestMultipleSplitOptions;
    use Moo;
    use MooX::Options;

    option 'opt'  => ( is => 'ro', format => 'i@', autosplit => ',' );
    option 'opt2' => ( is => 'ro', format => 'i@', autosplit => ',' );
    1;
}

local @ARGV = ( '--opt', '1,2', '--opt2', '3,4' );
my $opt = TestMultipleSplitOptions->new_with_options;

is_deeply $opt->opt,  [ 1, 2 ], 'opt got split correctly';
is_deeply $opt->opt2, [ 3, 4 ], 'opt2 got split correctly';

done_testing;



( run in 0.624 second using v1.01-cache-2.11-cpan-ceb78f64989 )