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