convert all uses of Test::Exception to Test::Fatal.
[gitmo/MooseX-Getopt.git] / t / 009_gld_and_explicit_options.t
CommitLineData
0df9248e 1#!/usr/bin/perl
2
3use strict;
4use warnings;
5
6a378fbd 6use Test::More tests => 5;
aabf4179 7use Test::Fatal;
0df9248e 8
6a378fbd 9use Test::Requires {
10 'Getopt::Long::Descriptive' => 0.01, # skip all if not installed
11};
12
13use_ok('MooseX::Getopt');
0df9248e 14
15{
16 package Testing::Foo;
17 use Moose;
2557b526 18
0df9248e 19 with 'MooseX::Getopt';
2557b526 20
0df9248e 21 has 'bar' => (
22 is => 'ro',
2557b526 23 isa => 'Int',
0df9248e 24 required => 1,
25 );
2557b526 26
0df9248e 27 has 'baz' => (
28 is => 'ro',
2557b526 29 isa => 'Int',
30 required => 1,
31 );
0df9248e 32}
33
b56c8123 34@ARGV = qw(--bar 10);
0df9248e 35
36my $foo;
aabf4179 37ok ! exception {
0df9248e 38 $foo = Testing::Foo->new_with_options(baz => 100);
aabf4179 39}, '... this should work';
0df9248e 40isa_ok($foo, 'Testing::Foo');
41
42is($foo->bar, 10, '... got the right values');
43is($foo->baz, 100, '... got the right values');
44
45
46
47
48