#!/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;
}
{
- package MooseX::Empty;
+ package MouseX::Empty;
use Mouse ();
Mouse::Exporter->setup_import_methods( also => 'Mouse' );
}
{
- package WantsMoose;
+ package WantsMouse;
- MooseX::Empty->import();
+ MouseX::Empty->import();
sub foo { 1 }
- ::can_ok( 'WantsMoose', 'has' );
- ::can_ok( 'WantsMoose', 'with' );
- ::can_ok( 'WantsMoose', 'foo' );
+ ::can_ok( 'WantsMouse', 'has' );
+ ::can_ok( 'WantsMouse', 'with' );
+ ::can_ok( 'WantsMouse', 'foo' );
- MooseX::Empty->unimport();
+ MouseX::Empty->unimport();
}
{
# namespace::clean(0.08)-based solution, but had to abandon it
# because it cleans the namespace _later_ (when the file scope
# ends).
- ok( ! WantsMoose->can('has'), 'WantsMoose::has() has been cleaned' );
- ok( ! WantsMoose->can('with'), 'WantsMoose::with() has been cleaned' );
- can_ok( 'WantsMoose', 'foo' );
+ ok( ! WantsMouse->can('has'), 'WantsMouse::has() has been cleaned' );
+ ok( ! WantsMouse->can('with'), 'WantsMouse::with() has been cleaned' );
+ can_ok( 'WantsMouse', 'foo' );
# This makes sure that Mouse->init_meta() happens properly
- isa_ok( WantsMoose->meta(), 'Mouse::Meta::Class' );
- isa_ok( WantsMoose->new(), 'Mouse::Object' );
+ isa_ok( WantsMouse->meta(), 'Mouse::Meta::Class' );
+ isa_ok( WantsMouse->new(), 'Mouse::Object' );
}
{
- package MooseX::Sugar;
+ package MouseX::Sugar;
use Mouse ();
{
package WantsSugar;
- MooseX::Sugar->import();
+ MouseX::Sugar->import();
sub foo { 1 }
::is( wrapped1(), 'WantsSugar called wrapped1',
'wrapped1 identifies the caller correctly' );
- MooseX::Sugar->unimport();
+ MouseX::Sugar->unimport();
}
{
}
{
- package MooseX::MoreSugar;
+ package MouseX::MoreSugar;
use Mouse ();
sub wrapped2 {
- my $caller = shift->name;
+ my $caller = shift;
return $caller . ' called wrapped2';
}
}
Mouse::Exporter->setup_import_methods(
- with_meta => ['wrapped2'],
- as_is => ['as_is1'],
- also => 'MooseX::Sugar',
+ with_caller => ['wrapped2'],
+ as_is => ['as_is1'],
+ also => 'MouseX::Sugar',
);
}
{
package WantsMoreSugar;
- MooseX::MoreSugar->import();
+ MouseX::MoreSugar->import();
sub foo { 1 }
::is( as_is1(), 'as_is1',
'as_is1 works as expected' );
- MooseX::MoreSugar->unimport();
+ MouseX::MoreSugar->unimport();
}
{
}
{
- package MooseX::CircularAlso;
+ package MouseX::CircularAlso;
use Mouse ();
::dies_ok(
sub {
Mouse::Exporter->setup_import_methods(
- also => [ 'Mouse', 'MooseX::CircularAlso' ],
+ also => [ 'Mouse', 'MouseX::CircularAlso' ],
);
},
'a circular reference in also dies with an error'
::like(
$@,
- qr/\QCircular reference in 'also' parameter to Mouse::Exporter between MooseX::CircularAlso and MooseX::CircularAlso/,
+ qr/\QCircular reference in 'also' parameter to Mouse::Exporter between MouseX::CircularAlso and MouseX::CircularAlso/,
'got the expected error from circular reference in also'
);
}
{
- package MooseX::NoAlso;
+ package MouseX::NoAlso;
use Mouse ();
}
{
- package MooseX::NotExporter;
+ package MouseX::NotExporter;
use Mouse ();
}
{
- package MooseX::OverridingSugar;
+ package MouseX::OverridingSugar;
use Mouse ();
sub has {
- my $caller = shift->name;
+ my $caller = shift;
return $caller . ' called has';
}
Mouse::Exporter->setup_import_methods(
- with_meta => ['has'],
- also => 'Mouse',
+ with_caller => ['has'],
+ also => 'Mouse',
);
}
{
package WantsOverridingSugar;
- MooseX::OverridingSugar->import();
+ MouseX::OverridingSugar->import();
::can_ok( 'WantsOverridingSugar', 'has' );
::can_ok( 'WantsOverridingSugar', 'with' );
::is( has('foo'), 'WantsOverridingSugar called has',
- 'has from MooseX::OverridingSugar is called, not has from Mouse' );
+ 'has from MouseX::OverridingSugar is called, not has from Mouse' );
- MooseX::OverridingSugar->unimport();
+ MouseX::OverridingSugar->unimport();
}
{
::stderr_like {
Mouse::Exporter->setup_import_methods(
also => ['Mouse'],
- with_meta => ['does_not_exist'],
+ with_caller => ['does_not_exist'],
);
} qr/^Trying to export undefined sub NonExistentExport::does_not_exist/,
"warns when a non-existent method is requested to be exported";
{
package AllOptions;
use Mouse ();
- use Mouse::Deprecated -api_version => '0.88';
use Mouse::Exporter;
Mouse::Exporter->setup_import_methods(
ok( ! UseAllOptions->can($_), "UseAllOptions::$_ has been unimported" )
for qw( with_meta1 with_meta2 with_caller1 with_caller2 as_is1 );
}
-
-done_testing;