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