Params passed to new_with_options are no longer required
[gitmo/MooseX-Getopt.git] / t / 009_gld_and_explicit_options.t
1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5
6 use Test::More tests => 5;
7 use Test::Exception;
8
9 BEGIN { use_ok('MooseX::Getopt') }
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
30 @ARGV = qw(--bar 10);
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