1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
|
use strict;
use warnings;
use Test::More 0.88;
use if $ENV{AUTHOR_TESTING}, 'Test::Warnings';
use Getopt::Long::Descriptive;
use_ok('MooseX::Getopt::GLD');
{
package Engine::Foo;
use Moose;
with 'MooseX::Getopt::GLD' => { getopt_conf => [ 'pass_through' ] };
has 'foo' => (
is => 'ro',
isa => 'Int',
);
}
{
package Engine::Bar;
use Moose;
with 'MooseX::Getopt::GLD' => { getopt_conf => [ 'pass_through' ] };;
has 'bar' => (
is => 'ro',
isa => 'Int',
);
}
local @ARGV = ('--foo=10', '--bar=42');
{
my $foo = Engine::Foo->new_with_options();
isa_ok($foo, 'Engine::Foo');
is($foo->foo, 10, '... got the right value (10)');
}
{
my $bar = Engine::Bar->new_with_options();
isa_ok($bar, 'Engine::Bar');
is($bar->bar, 42, '... got the right value (42)');
}
done_testing;
|