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