Commit | Line | Data |
0611312e |
1 | use strict; |
2 | use warnings; |
3 | |
9fbb5be9 |
4 | use Test::More tests => 6; |
5 | use Test::NoWarnings 1.04 ':early'; |
0611312e |
6 | |
12f4bf75 |
7 | use Getopt::Long::Descriptive; |
0611312e |
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' => ( |
0611312e |
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' => ( |
0611312e |
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 | |