X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F009_gld_and_explicit_options.t;h=c095bdd0395515f04bf747ee88b8aab542b19482;hb=8582c92478a98d290912f5ed3f0171a7049ed05c;hp=266ff8cfba4df3ce1f2a6e1546ec3a1eb23cf407;hpb=630657d529277b7fb600febf001d8667d8e85184;p=gitmo%2FMooseX-Getopt.git diff --git a/t/009_gld_and_explicit_options.t b/t/009_gld_and_explicit_options.t index 266ff8c..c095bdd 100644 --- a/t/009_gld_and_explicit_options.t +++ b/t/009_gld_and_explicit_options.t @@ -3,41 +3,40 @@ use strict; use warnings; -use Test::More; -use Test::Exception; - -BEGIN { - eval 'use Getopt::Long::Descriptive;'; - plan skip_all => "Getopt::Long::Descriptive required for this test" if $@; - plan tests => 5; - use_ok('MooseX::Getopt'); -} +use Test::More tests => 5; +use Test::Fatal; + +use Test::Requires { + 'Getopt::Long::Descriptive' => 0.01, # skip all if not installed +}; + +use_ok('MooseX::Getopt'); { package Testing::Foo; use Moose; - + with 'MooseX::Getopt'; - + has 'bar' => ( is => 'ro', - isa => 'Int', + isa => 'Int', required => 1, ); - + has 'baz' => ( is => 'ro', - isa => 'Int', - required => 1, - ); + isa => 'Int', + required => 1, + ); } @ARGV = qw(--bar 10); my $foo; -lives_ok { +ok ! exception { $foo = Testing::Foo->new_with_options(baz => 100); -} '... this should work'; +}, '... this should work'; isa_ok($foo, 'Testing::Foo'); is($foo->bar, 10, '... got the right values');