Params passed to new_with_options are no longer required
[gitmo/MooseX-Getopt.git] / t / 009_gld_and_explicit_options.t
CommitLineData
0df9248e 1#!/usr/bin/perl
2
3use strict;
4use warnings;
5
b56c8123 6use Test::More tests => 5;
0df9248e 7use Test::Exception;
8
b56c8123 9BEGIN { 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
32my $foo;
33lives_ok {
34 $foo = Testing::Foo->new_with_options(baz => 100);
35} '... this should work';
36isa_ok($foo, 'Testing::Foo');
37
38is($foo->bar, 10, '... got the right values');
39is($foo->baz, 100, '... got the right values');
40
41
42
43
44