test for warnings everywhere
[gitmo/MooseX-Getopt.git] / t / 009_gld_and_explicit_options.t
1 use strict;
2 use warnings;
3
4 use Test::More tests => 6;
5 use Test::Fatal;
6 use Test::NoWarnings 1.04 ':early';
7
8 use Test::Requires {
9     'Getopt::Long::Descriptive' => 0.01, # skip all if not installed
10 };
11
12 use_ok('MooseX::Getopt');
13
14 {
15     package Testing::Foo;
16     use Moose;
17
18     with 'MooseX::Getopt';
19
20     has 'bar' => (
21         is       => 'ro',
22         isa      => 'Int',
23         required => 1,
24     );
25
26     has 'baz' => (
27         is       => 'ro',
28         isa      => 'Int',
29         required => 1,
30     );
31 }
32
33 @ARGV = qw(--bar 10);
34
35 my $foo;
36 ok ! exception {
37     $foo = Testing::Foo->new_with_options(baz => 100);
38 }, '... this should work';
39 isa_ok($foo, 'Testing::Foo');
40
41 is($foo->bar, 10, '... got the right values');
42 is($foo->baz, 100, '... got the right values');
43
44
45
46
47