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