X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F004_nogetop.t;h=9592ed4862d2eff01dba30b1c50a2e16c1d153b4;hb=195fb408a61ad34e0e41887b4f9f8dc384dd5da5;hp=03b09db33adce00b14a1a581b51f3adbfc94f7d7;hpb=a01f08fb1f7451412f578e905179324dfd2ec590;p=gitmo%2FMooseX-Getopt.git diff --git a/t/004_nogetop.t b/t/004_nogetop.t index 03b09db..9592ed4 100644 --- a/t/004_nogetop.t +++ b/t/004_nogetop.t @@ -1,23 +1,22 @@ -#!/usr/bin/perl - use strict; use warnings; -use Test::More tests => 8; +use Test::More tests => 10; +use Test::Fatal 0.003; +use Test::NoWarnings 1.04 ':early'; BEGIN { use_ok('MooseX::Getopt'); } { - package App; use Moose; with 'MooseX::Getopt'; has 'data' => ( - metaclass => 'MooseX::Getopt::Meta::Attribute', + traits => ['Getopt'], is => 'ro', isa => 'Str', default => 'file.dat', @@ -25,7 +24,7 @@ BEGIN { ); has 'cow' => ( - metaclass => 'Getopt', + traits => ['Getopt'], is => 'ro', isa => 'Str', default => 'moo', @@ -33,7 +32,7 @@ BEGIN { ); has 'horse' => ( - metaclass => 'MooseX::Getopt::Meta::Attribute', + traits => ['Getopt'], is => 'ro', isa => 'Str', default => 'bray', @@ -65,14 +64,14 @@ BEGIN { ); has 'private_stuff' => ( - metaclass => 'MooseX::Getopt::Meta::NoGetopt', + traits => ['NoGetopt'], is => 'ro', isa => 'Int', default => 713 ); has '_private_stuff_cmdline' => ( - metaclass => 'MooseX::Getopt::Meta::Attribute', + traits => ['Getopt'], is => 'ro', isa => 'Int', default => 832, @@ -94,3 +93,9 @@ BEGIN { is_deeply( $app->details, {}, '... details is {} as expected' ); is($app->private_stuff, 713, '... private stuff is 713 as expected'); } + +{ + local @ARGV = (qw/--private_stuff 317/); + + like exception { App->new_with_options }, qr/Unknown option: private_stuff/; +}