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