Regenerate test files
[gitmo/Mouse.git] / t / 050_metaclasses / 012_moose_exporter.t
similarity index 82%
rename from t/050_metaclasses/failing/012_moose_exporter.t
rename to t/050_metaclasses/012_moose_exporter.t
index 63126aa..39ac3ef 100644 (file)
@@ -1,16 +1,17 @@
 #!/usr/bin/perl
+# This is automatically generated by author/import-moose-test.pl.
+# DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!!
+use t::lib::MooseCompat;
 
 use strict;
 use warnings;
 
 use Test::More;
 use Test::Exception;
-BEGIN {
-    eval "use Test::Output;";
-    plan skip_all => "Test::Output is required for this test" if $@;
-    plan tests => 65;
-}
 
+use Test::Requires {
+    'Test::Output' => '0.01', # skip all if not installed
+};
 
 {
     package HasOwnImmutable;
@@ -30,24 +31,24 @@ BEGIN {
 }
 
 {
-    package MouseX::Empty;
+    package MooseX::Empty;
 
     use Mouse ();
     Mouse::Exporter->setup_import_methods( also => 'Mouse' );
 }
 
 {
-    package WantsMouse;
+    package WantsMoose;
 
-    MouseX::Empty->import();
+    MooseX::Empty->import();
 
     sub foo { 1 }
 
-    ::can_ok( 'WantsMouse', 'has' );
-    ::can_ok( 'WantsMouse', 'with' );
-    ::can_ok( 'WantsMouse', 'foo' );
+    ::can_ok( 'WantsMoose', 'has' );
+    ::can_ok( 'WantsMoose', 'with' );
+    ::can_ok( 'WantsMoose', 'foo' );
 
-    MouseX::Empty->unimport();
+    MooseX::Empty->unimport();
 }
 
 {
@@ -56,18 +57,18 @@ BEGIN {
     # namespace::clean(0.08)-based solution, but had to abandon it
     # because it cleans the namespace _later_ (when the file scope
     # ends).
-    ok( ! WantsMouse->can('has'),  'WantsMouse::has() has been cleaned' );
-    ok( ! WantsMouse->can('with'), 'WantsMouse::with() has been cleaned' );
-    can_ok( 'WantsMouse', 'foo' );
+    ok( ! WantsMoose->can('has'),  'WantsMoose::has() has been cleaned' );
+    ok( ! WantsMoose->can('with'), 'WantsMoose::with() has been cleaned' );
+    can_ok( 'WantsMoose', 'foo' );
 
     # This makes sure that Mouse->init_meta() happens properly
-    isa_ok( WantsMouse->meta(), 'Mouse::Meta::Class' );
-    isa_ok( WantsMouse->new(), 'Mouse::Object' );
+    isa_ok( WantsMoose->meta(), 'Mouse::Meta::Class' );
+    isa_ok( WantsMoose->new(), 'Mouse::Object' );
 
 }
 
 {
-    package MouseX::Sugar;
+    package MooseX::Sugar;
 
     use Mouse ();
 
@@ -85,7 +86,7 @@ BEGIN {
 {
     package WantsSugar;
 
-    MouseX::Sugar->import();
+    MooseX::Sugar->import();
 
     sub foo { 1 }
 
@@ -96,7 +97,7 @@ BEGIN {
     ::is( wrapped1(), 'WantsSugar called wrapped1',
           'wrapped1 identifies the caller correctly' );
 
-    MouseX::Sugar->unimport();
+    MooseX::Sugar->unimport();
 }
 
 {
@@ -107,12 +108,12 @@ BEGIN {
 }
 
 {
-    package MouseX::MoreSugar;
+    package MooseX::MoreSugar;
 
     use Mouse ();
 
     sub wrapped2 {
-        my $caller = shift;
+        my $caller = shift->name;
         return $caller . ' called wrapped2';
     }
 
@@ -121,16 +122,16 @@ BEGIN {
     }
 
     Mouse::Exporter->setup_import_methods(
-        with_caller => ['wrapped2'],
-        as_is       => ['as_is1'],
-        also        => 'MouseX::Sugar',
+        with_meta => ['wrapped2'],
+        as_is     => ['as_is1'],
+        also      => 'MooseX::Sugar',
     );
 }
 
 {
     package WantsMoreSugar;
 
-    MouseX::MoreSugar->import();
+    MooseX::MoreSugar->import();
 
     sub foo { 1 }
 
@@ -147,7 +148,7 @@ BEGIN {
     ::is( as_is1(), 'as_is1',
           'as_is1 works as expected' );
 
-    MouseX::MoreSugar->unimport();
+    MooseX::MoreSugar->unimport();
 }
 
 {
@@ -195,14 +196,14 @@ BEGIN {
 }
 
 {
-    package MouseX::CircularAlso;
+    package MooseX::CircularAlso;
 
     use Mouse ();
 
     ::dies_ok(
         sub {
             Mouse::Exporter->setup_import_methods(
-                also => [ 'Mouse', 'MouseX::CircularAlso' ],
+                also => [ 'Mouse', 'MooseX::CircularAlso' ],
             );
         },
         'a circular reference in also dies with an error'
@@ -210,13 +211,13 @@ BEGIN {
 
     ::like(
         $@,
-        qr/\QCircular reference in 'also' parameter to Mouse::Exporter between MouseX::CircularAlso and MouseX::CircularAlso/,
+        qr/\QCircular reference in 'also' parameter to Mouse::Exporter between MooseX::CircularAlso and MooseX::CircularAlso/,
         'got the expected error from circular reference in also'
     );
 }
 
 {
-    package MouseX::NoAlso;
+    package MooseX::NoAlso;
 
     use Mouse ();
 
@@ -237,7 +238,7 @@ BEGIN {
 }
 
 {
-    package MouseX::NotExporter;
+    package MooseX::NotExporter;
 
     use Mouse ();
 
@@ -258,32 +259,32 @@ BEGIN {
 }
 
 {
-    package MouseX::OverridingSugar;
+    package MooseX::OverridingSugar;
 
     use Mouse ();
 
     sub has {
-        my $caller = shift;
+        my $caller = shift->name;
         return $caller . ' called has';
     }
 
     Mouse::Exporter->setup_import_methods(
-        with_caller => ['has'],
-        also        => 'Mouse',
+        with_meta => ['has'],
+        also      => 'Mouse',
     );
 }
 
 {
     package WantsOverridingSugar;
 
-    MouseX::OverridingSugar->import();
+    MooseX::OverridingSugar->import();
 
     ::can_ok( 'WantsOverridingSugar', 'has' );
     ::can_ok( 'WantsOverridingSugar', 'with' );
     ::is( has('foo'), 'WantsOverridingSugar called has',
-          'has from MouseX::OverridingSugar is called, not has from Mouse' );
+          'has from MooseX::OverridingSugar is called, not has from Mouse' );
 
-    MouseX::OverridingSugar->unimport();
+    MooseX::OverridingSugar->unimport();
 }
 
 {
@@ -299,7 +300,7 @@ BEGIN {
     ::stderr_like {
         Mouse::Exporter->setup_import_methods(
             also => ['Mouse'],
-            with_caller => ['does_not_exist'],
+            with_meta => ['does_not_exist'],
         );
     } qr/^Trying to export undefined sub NonExistentExport::does_not_exist/,
       "warns when a non-existent method is requested to be exported";
@@ -317,6 +318,7 @@ BEGIN {
 {
     package AllOptions;
     use Mouse ();
+    use Mouse::Deprecated -api_version => '0.88';
     use Mouse::Exporter;
 
     Mouse::Exporter->setup_import_methods(
@@ -389,3 +391,5 @@ BEGIN {
     ok( ! UseAllOptions->can($_), "UseAllOptions::$_ has been unimported" )
         for qw( with_meta1 with_meta2 with_caller1 with_caller2 as_is1 );
 }
+
+done_testing;