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