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 | |
6a378fbd |
8 | use Test::Requires { |
9 | 'Getopt::Long::Descriptive' => 0.01, # skip all if not installed |
10 | }; |
11 | |
12 | use_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 | |
35 | my $foo; |
aabf4179 |
36 | ok ! exception { |
0df9248e |
37 | $foo = Testing::Foo->new_with_options(baz => 100); |
aabf4179 |
38 | }, '... this should work'; |
0df9248e |
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 | |