Make sure that applied_attribute roles don't spill over to other roles to during...
[gitmo/Moose.git] / t / 010_basics / 030_deprecations.t
index 7074266..cb2eaf9 100644 (file)
@@ -1,7 +1,7 @@
 use strict;
 use warnings;
 
-use Test::Exception;
+use Test::Fatal;
 use Test::More;
 
 use Test::Requires {
@@ -24,7 +24,7 @@ use Test::Requires {
 
     use Moose;
 
-    ::lives_and(
+    ::is( ::exception (
         sub {
             ::stderr_like{ has foo => (
                     traits => ['String'],
@@ -32,7 +32,7 @@ use Test::Requires {
                     isa    => 'Str',
                 );
                 }
-                qr{\QAllowing a native trait to automatically supply a default is deprecated. You can avoid this warning by supply a default, builder, or making the attribute required at t/010_basics/030_deprecations.t line},
+                qr{\QAllowing a native trait to automatically supply a default is deprecated. You can avoid this warning by supplying a default, builder, or making the attribute required at $0 line},
                 'Not providing a default for native String trait warns';
 
             ::stderr_is{ has bar => (
@@ -43,13 +43,13 @@ use Test::Requires {
                 } q{}, 'No warning when _default_is is set';
 
             ::stderr_like{ Foo->new->bar }
-                qr{\QThe bar method in the Foo class was automatically created by the native delegation trait for the bar attribute. This "default is" feature is deprecated. Explicitly set "is" or define accessor names to avoid this at t/010_basics/030_deprecations.t line},
+                qr{\QThe bar method in the Foo class was automatically created by the native delegation trait for the bar attribute. This "default is" feature is deprecated. Explicitly set "is" or define accessor names to avoid this at $0 line},
                 'calling a reader on a method created by a _default_is warns';
 
             ::stderr_like{ with 'Role' =>
                     { excludes => ['thing'], alias => { thing => 'thing2' } };
                 }
-                qr/\QThe alias and excludes options for role application have been renamed -alias and -excludes (applying Role to Foo - do you need to upgrade Foo?)/,
+                qr/\QThe alias and excludes options for role application have been renamed -alias and -excludes (Foo is consuming Role - do you need to upgrade Foo?)/,
                 'passing excludes or alias with a leading dash warns';
             ::ok(
                 !Foo->meta->has_method('thing'),
@@ -59,15 +59,16 @@ use Test::Requires {
                 Foo->meta->has_method('thing2'),
                 'thing2 method is created as alias in role application'
             );
-        } );
-    }
+        }
+    ), undef );
+}
 
 {
     package Pack1;
 
     use Moose;
 
-    ::lives_and(
+    ::is( ::exception (
         sub {
             ::stderr_is{ has foo => (
                     traits  => ['String'],
@@ -93,7 +94,7 @@ use Test::Requires {
             ::stderr_is{ Pack1->new->_bar } q{},
                 'Providing a reader for a String trait avoids default is warning';
         }
-    );
+    ), undef );
 
     sub _build_foo { q{} }
 }
@@ -103,7 +104,7 @@ use Test::Requires {
 
     use Moose;
 
-    ::lives_and(
+    ::is( ::exception (
         sub {
             ::stderr_is{ has foo => (
                     traits   => ['String'],
@@ -130,6 +131,7 @@ use Test::Requires {
                 q{},
                 'Providing a writer for a String trait avoids default is warning';
         }
+    ), undef );
 }
 
 {
@@ -137,7 +139,7 @@ use Test::Requires {
 
     use Moose;
 
-    ::lives_and(
+    ::is( ::exception (
         sub {
             ::stderr_is{ has foo => (
                     traits     => ['String'],
@@ -164,7 +166,7 @@ use Test::Requires {
                 q{},
                 'Providing a accessor for a String trait avoids default is warning';
         }
-    );
+    ), undef );
 
     sub _build_foo { q{} }
 }