make all warnings fatal in tests
[gitmo/MooseX-Getopt.git] / t / 102_basic_basic.t
index b5fbcbd..49042ea 100644 (file)
@@ -1,9 +1,9 @@
-#!/usr/bin/perl
-
 use strict;
-use warnings;
+use warnings FATAL => 'all';
 
-use Test::More tests => 69;
+use Test::More tests => 70;
+use Test::Moose;
+use Test::NoWarnings 1.04 ':early';
 
 BEGIN {
     use_ok('MooseX::Getopt::Basic');
@@ -12,11 +12,11 @@ BEGIN {
 {
     package App;
     use Moose;
-    
+
     with 'MooseX::Getopt::Basic';
 
     has 'data' => (
-        metaclass => 'MooseX::Getopt::Meta::Attribute',        
+        traits    => ['Getopt'],
         is        => 'ro',
         isa       => 'Str',
         default   => 'file.dat',
@@ -24,7 +24,7 @@ BEGIN {
     );
 
     has 'cow' => (
-        metaclass   => 'Getopt',        
+        traits      => ['Getopt'],
         is          => 'ro',
         isa         => 'Str',
         default     => 'moo',
@@ -32,7 +32,7 @@ BEGIN {
     );
 
     has 'horse' => (
-        metaclass   => 'MooseX::Getopt::Meta::Attribute',        
+        traits      => ['Getopt'],
         is          => 'ro',
         isa         => 'Str',
         default     => 'bray',
@@ -48,15 +48,15 @@ BEGIN {
 
     has 'verbose' => (
         is     => 'ro',
-        isa    => 'Bool',       
+        isa    => 'Bool',
     );
-    
+
     has 'libs' => (
         is      => 'ro',
         isa     => 'ArrayRef',
         default => sub { [] },
-    ); 
-    
+    );
+
     has 'details' => (
         is      => 'ro',
         isa     => 'HashRef',
@@ -70,21 +70,20 @@ BEGIN {
     );
 
     has '_private_stuff_cmdline' => (
-        metaclass => 'MooseX::Getopt::Meta::Attribute',        
+        traits      => ['Getopt'],
         is        => 'ro',
         isa       => 'Int',
         default   => 832,
         cmd_flag  => 'p',
     );
-  
 }
 
 foreach my $attr_name (qw(data cow horse _private_stuff_cmdline)) {
     my $attr = App->meta->get_attribute($attr_name);
     isa_ok($attr, 'Moose::Meta::Attribute');
-    isa_ok($attr, 'MooseX::Getopt::Meta::Attribute');
+    does_ok($attr, 'MooseX::Getopt::Meta::Attribute::Trait');
     can_ok($attr, 'cmd_flag');
-    can_ok($attr, 'cmd_aliases');    
+    can_ok($attr, 'cmd_aliases');
 }
 
 {
@@ -94,10 +93,10 @@ foreach my $attr_name (qw(data cow horse _private_stuff_cmdline)) {
     isa_ok($app, 'App');
 
     ok(!$app->verbose, '... verbosity is off as expected');
-    is($app->length, 24, '... length is 24 as expected');    
-    is($app->data, 'file.dat', '... data is file.dat as expected');        
-    is_deeply($app->libs, [], '... libs is [] as expected'); 
-    is_deeply($app->details, {}, '... details is {} as expected');           
+    is($app->length, 24, '... length is 24 as expected');
+    is($app->data, 'file.dat', '... data is file.dat as expected');
+    is_deeply($app->libs, [], '... libs is [] as expected');
+    is_deeply($app->details, {}, '... details is {} as expected');
 }
 
 {
@@ -107,10 +106,10 @@ foreach my $attr_name (qw(data cow horse _private_stuff_cmdline)) {
     isa_ok($app, 'App');
 
     ok($app->verbose, '... verbosity is turned on as expected');
-    is($app->length, 50, '... length is 50 as expected');    
-    is($app->data, 'file.dat', '... data is file.dat as expected'); 
-    is_deeply($app->libs, [], '... libs is [] as expected');  
-    is_deeply($app->details, {}, '... details is {} as expected');                            
+    is($app->length, 50, '... length is 50 as expected');
+    is($app->data, 'file.dat', '... data is file.dat as expected');
+    is_deeply($app->libs, [], '... libs is [] as expected');
+    is_deeply($app->details, {}, '... details is {} as expected');
 }
 
 {
@@ -120,10 +119,10 @@ foreach my $attr_name (qw(data cow horse _private_stuff_cmdline)) {
     isa_ok($app, 'App');
 
     ok($app->verbose, '... verbosity is turned on as expected');
-    is($app->length, 24, '... length is 24 as expected');    
-    is($app->data, 'foo.txt', '... data is foo.txt as expected'); 
-    is_deeply($app->libs, [], '... libs is [] as expected');    
-    is_deeply($app->details, {}, '... details is {} as expected');                             
+    is($app->length, 24, '... length is 24 as expected');
+    is($app->data, 'foo.txt', '... data is foo.txt as expected');
+    is_deeply($app->libs, [], '... libs is [] as expected');
+    is_deeply($app->details, {}, '... details is {} as expected');
 }
 
 {
@@ -133,12 +132,12 @@ foreach my $attr_name (qw(data cow horse _private_stuff_cmdline)) {
     isa_ok($app, 'App');
 
     ok($app->verbose, '... verbosity is turned on as expected');
-    is($app->length, 24, '... length is 24 as expected');    
-    is($app->data, 'file.dat', '... data is foo.txt as expected'); 
-    is_deeply($app->libs, 
-    ['libs/', 'includes/lib'], 
-    '... libs is [libs/, includes/lib] as expected');   
-    is_deeply($app->details, {}, '... details is {} as expected');                              
+    is($app->length, 24, '... length is 24 as expected');
+    is($app->data, 'file.dat', '... data is foo.txt as expected');
+    is_deeply($app->libs,
+    ['libs/', 'includes/lib'],
+    '... libs is [libs/, includes/lib] as expected');
+    is_deeply($app->details, {}, '... details is {} as expected');
 }
 
 {
@@ -148,12 +147,12 @@ foreach my $attr_name (qw(data cow horse _private_stuff_cmdline)) {
     isa_ok($app, 'App');
 
     ok(!$app->verbose, '... verbosity is turned on as expected');
-    is($app->length, 24, '... length is 24 as expected');    
-    is($app->data, 'file.dat', '... data is foo.txt as expected'); 
-    is_deeply($app->libs, [], '... libs is [] as expected');    
-    is_deeply($app->details, 
-    { os => 'mac', name => 'foo' }, 
-    '... details is { os => mac, name => foo } as expected');                              
+    is($app->length, 24, '... length is 24 as expected');
+    is($app->data, 'file.dat', '... data is foo.txt as expected');
+    is_deeply($app->libs, [], '... libs is [] as expected');
+    is_deeply($app->details,
+    { os => 'mac', name => 'foo' },
+    '... details is { os => mac, name => foo } as expected');
 }
 
 {
@@ -164,10 +163,10 @@ foreach my $attr_name (qw(data cow horse _private_stuff_cmdline)) {
     isa_ok($app, 'App');
 
     ok(!$app->verbose, '... verbosity is turned off as expected');
-    is($app->length, 24, '... length is 24 as expected');    
-    is($app->data, 'file.dat', '... file is file.dat as expected');   
-    is_deeply($app->libs, [], '... libs is [] as expected');                
-    is_deeply($app->details, {}, '... details is {} as expected');               
+    is($app->length, 24, '... length is 24 as expected');
+    is($app->data, 'file.dat', '... file is file.dat as expected');
+    is_deeply($app->libs, [], '... libs is [] as expected');
+    is_deeply($app->details, {}, '... details is {} as expected');
 }
 
 # Test cmd_alias without cmd_flag