test for warnings everywhere
[gitmo/MooseX-Getopt.git] / t / 004_nogetop.t
index 03b09db..b90b914 100644 (file)
@@ -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',
+        metaclass => 'Getopt',
         is        => 'ro',
         isa       => 'Str',
         default   => 'file.dat',
@@ -33,7 +32,7 @@ BEGIN {
     );
 
     has 'horse' => (
-        metaclass   => 'MooseX::Getopt::Meta::Attribute',
+        metaclass   => 'Getopt',
         is          => 'ro',
         isa         => 'Str',
         default     => 'bray',
@@ -65,14 +64,14 @@ BEGIN {
     );
 
     has 'private_stuff' => (
-        metaclass => 'MooseX::Getopt::Meta::NoGetopt',
+        metaclass => 'NoGetopt',
         is       => 'ro',
         isa      => 'Int',
         default  => 713
     );
 
     has '_private_stuff_cmdline' => (
-        metaclass => 'MooseX::Getopt::Meta::Attribute',
+        metaclass => '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/;
+}