explicitly test that shift returns undef and does not die on an empty array
[gitmo/Moose.git] / t / 020_attributes / 022_illegal_options_for_inheritance.t
index d806670..9f83475 100644 (file)
@@ -24,12 +24,12 @@ use Test::Fatal;
 
     extends 'Foo';
 
-    ::ok ! ::exception { has '+foo' => (is => 'rw') }, "can override is";
-    ::like ::exception { has '+foo' => (reader => 'bar') }, qr/illegal/, "can't override reader";
-    ::ok ! ::exception { has '+foo' => (clearer => 'baz') },  "can override unspecified things";
+    ::is( ::exception { has '+foo' => (is => 'rw') }, undef, "can override is" );
+    ::like( ::exception { has '+foo' => (reader => 'bar') }, qr/illegal/, "can't override reader" );
+    ::is( ::exception { has '+foo' => (clearer => 'baz') }, undef, "can override unspecified things" );
 
-    ::like ::exception { has '+bar' => (clearer => 'quux') },  qr/illegal/, "can't override clearer";
-    ::ok ! ::exception { has '+bar' => (predicate => 'has_bar') },  "can override unspecified things";
+    ::like( ::exception { has '+bar' => (clearer => 'quux') }, qr/illegal/, "can't override clearer" );
+    ::is( ::exception { has '+bar' => (predicate => 'has_bar') }, undef, "can override unspecified things" );
 }
 
 {
@@ -47,13 +47,13 @@ use Test::Fatal;
     package Bar;
     use Moose;
 
-    ::ok ! ::exception {
+    ::is( ::exception {
         has bar => (
             traits            => ['Bar::Meta::Attribute'],
             my_illegal_option => 'FOO',
             is                => 'bare',
         );
-    }, "can use illegal options";
+    }, undef, "can use illegal options" );
 
     has baz => (
         traits => ['Bar::Meta::Attribute'],
@@ -67,11 +67,8 @@ use Test::Fatal;
 
     extends 'Bar';
 
-    ::like ::exception { has '+bar' => (my_illegal_option => 'BAR') },
-                qr/illegal/,
-                "can't override illegal attribute";
-    ::ok ! ::exception { has '+baz' => (my_illegal_option => 'BAR') },
-               "can add illegal option if superclass doesn't set it";
+    ::like( ::exception { has '+bar' => (my_illegal_option => 'BAR') }, qr/illegal/, "can't override illegal attribute" );
+    ::is( ::exception { has '+baz' => (my_illegal_option => 'BAR') }, undef, "can add illegal option if superclass doesn't set it" );
 }
 
 my $bar_attr = Bar->meta->get_attribute('bar');