}
{
- package MooseX::SomeAwesomeDBFields;
+ package MouseX::SomeAwesomeDBFields;
# implementation of methods not called in the example deliberately
# omitted
Mouse::Util::MetaRole::apply_metaroles(
for => __PACKAGE__,
- class_metaroles => { instance => ['MooseX::SomeAwesomeDBFields'] },
+ class_metaroles => { instance => ['MouseX::SomeAwesomeDBFields'] },
);
lives_ok {
{
- package Test::MooseX::Types::Maybe;
+ package Test::MouseX::Types::Maybe;
use Mouse;
has 'Maybe_Int' => (is=>'rw', isa=>'Maybe[Int]');
has 'Maybe_HashRefInt' => (is=>'rw', isa=>'Maybe[HashRef[Int]]');
}
-ok my $obj = Test::MooseX::Types::Maybe->new
+ok my $obj = Test::MouseX::Types::Maybe->new
=> 'Create good test object';
## Maybe[Int]
# &Mouse::import. we want to make sure it still works.
{
- package MooseAlike1;
+ package MouseAlike1;
use strict;
use warnings;
{
package Foo;
- MooseAlike1->import();
+ MouseAlike1->import();
::lives_ok( sub { has( 'size', is => 'bare' ) },
- 'has was exported via MooseAlike1' );
+ 'has was exported via MouseAlike1' );
- MooseAlike1->unimport();
+ MouseAlike1->unimport();
}
ok( ! Foo->can('has'),
- 'No has sub in Foo after MooseAlike1 is unimported' );
+ 'No has sub in Foo after MouseAlike1 is unimported' );
ok( Foo->can('meta'),
'Foo has a meta method' );
isa_ok( Foo->meta(), 'Mouse::Meta::Class' );
{
- package MooseAlike2;
+ package MouseAlike2;
use strict;
use warnings;
{
package Bar;
- MooseAlike2->import();
+ MouseAlike2->import();
::lives_ok( sub { has( 'size', is => 'bare' ) },
- 'has was exported via MooseAlike2' );
+ 'has was exported via MouseAlike2' );
- MooseAlike2->unimport();
+ MouseAlike2->unimport();
}
ok( ! Bar->can('has'),
- 'No has sub in Bar after MooseAlike2 is unimported' );
+ 'No has sub in Bar after MouseAlike2 is unimported' );
ok( Bar->can('meta'),
'Bar has a meta method' );
isa_ok( Bar->meta(), 'Mouse::Meta::Class' );
# This tests applying meta roles to a metaclass's metaclass. This is
# completely insane, but is exactly what happens with
# Fey::Meta::Class::Table. It's a subclass of Mouse::Meta::Class
-# itself, and then it _uses_ MooseX::ClassAttribute, so the metaclass
+# itself, and then it _uses_ MouseX::ClassAttribute, so the metaclass
# for Fey::Meta::Class::Table does a role.
#
# At one point this caused a metaclass incompatibility error down
}
{
- package ExportsMoose;
+ package ExportsMouse;
Mouse::Exporter->setup_import_methods(
also => 'Mouse',
}
lives_ok {
- package UsesExportedMoose;
- ExportsMoose->import;
+ package UsesExportedMouse;
+ ExportsMouse->import;
} 'import module which loads a role from disk during init_meta';
{
}
{
- package Foo::Exporter::WithMoose;
+ package Foo::Exporter::WithMouse;
use Mouse ();
use Mouse::Exporter;
{
package Foo2;
- Foo::Exporter::WithMoose->import;
+ Foo::Exporter::WithMouse->import;
has(foo => (is => 'ro'));
}
{
- package Foo::Exporter::WithMooseRole;
+ package Foo::Exporter::WithMouseRole;
use Mouse::Role ();
use Mouse::Exporter;
{
package Foo2::Role;
- Foo::Exporter::WithMooseRole->import;
+ Foo::Exporter::WithMouseRole->import;
::isa_ok(Foo2::Role->meta, 'Mouse::Meta::Role');
::does_ok(Foo2::Role->meta, 'Foo::Trait::Class');
# This tests applying meta roles to a metaclass's metaclass. This is
# completely insane, but is exactly what happens with
# Fey::Meta::Class::Table. It's a subclass of Mouse::Meta::Class
-# itself, and then it _uses_ MooseX::ClassAttribute, so the metaclass
+# itself, and then it _uses_ MouseX::ClassAttribute, so the metaclass
# for Fey::Meta::Class::Table does a role.
#
# At one point this caused a metaclass incompatibility error down
}
{
- package ExportsMoose;
+ package ExportsMouse;
Mouse::Exporter->setup_import_methods(
also => 'Mouse',
}
lives_ok {
- package UsesExportedMoose;
- ExportsMoose->import;
+ package UsesExportedMouse;
+ ExportsMouse->import;
} 'import module which loads a role from disk during init_meta';
{
## make some metaclasses
{
- package ProtoMoose::Meta::Instance;
+ package ProtoMouse::Meta::Instance;
use Mouse;
BEGIN { extends 'Mouse::Meta::Instance' };
}
{
- package ProtoMoose::Meta::Method::Accessor;
+ package ProtoMouse::Meta::Method::Accessor;
use Mouse;
BEGIN { extends 'Mouse::Meta::Method' };
}
{
- package ProtoMoose::Meta::Attribute;
+ package ProtoMouse::Meta::Attribute;
use Mouse;
BEGIN { extends 'Mouse::Meta::Attribute' };
- sub accessor_metaclass { 'ProtoMoose::Meta::Method::Accessor' }
+ sub accessor_metaclass { 'ProtoMouse::Meta::Method::Accessor' }
}
{
- package ProtoMoose::Meta::Class;
+ package ProtoMouse::Meta::Class;
use Mouse;
BEGIN { extends 'Mouse::Meta::Class' };
# not work here, have to investigate
# it later - SL
(shift)->SUPER::initialize(@_,
- instance_metaclass => 'ProtoMoose::Meta::Instance',
- attribute_metaclass => 'ProtoMoose::Meta::Attribute',
+ instance_metaclass => 'ProtoMouse::Meta::Instance',
+ attribute_metaclass => 'ProtoMouse::Meta::Attribute',
);
}
}
{
- package ProtoMoose::Object;
- use metaclass 'ProtoMoose::Meta::Class';
+ package ProtoMouse::Object;
+ use metaclass 'ProtoMouse::Meta::Class';
use Mouse;
sub new {
package Foo;
use Mouse;
- extends 'ProtoMoose::Object';
+ extends 'ProtoMouse::Object';
has 'bar' => (is => 'rw');
}
## ------------------------------------------------------------------
## Check that metaclasses are working/inheriting properly
-foreach my $class (qw/ProtoMoose::Object Foo Bar/) {
+foreach my $class (qw/ProtoMouse::Object Foo Bar/) {
isa_ok($class->meta,
- 'ProtoMoose::Meta::Class',
+ 'ProtoMouse::Meta::Class',
'... got the right metaclass for ' . $class . ' ->');
is($class->meta->instance_metaclass,
- 'ProtoMoose::Meta::Instance',
+ 'ProtoMouse::Meta::Instance',
'... got the right instance meta for ' . $class);
is($class->meta->attribute_metaclass,
- 'ProtoMoose::Meta::Attribute',
+ 'ProtoMouse::Meta::Attribute',
'... got the right attribute meta for ' . $class);
}
use warnings FATAL => 'all';
use File::Path qw(mkpath);
use File::Find;
+use File::Basename qw(basename dirname);
use autodie;
my($moose_dir, $result) = @ARGV;
my @tests;
sub wanted {
return if /native_traits/;
- (my $mouse_test = $_) =~ s{\A $moose_dir/t }{$result}xmso;
- (my $mouse_failing_test = $_) =~ s{\A $moose_dir/t }{$result-failing}xmso;
+ my $file = $_;
+ (my $basename = basename($file)) =~ s/Moose/Mouse/g;
+ $file = dirname($file) . '/' . $basename;
+ (my $test = $file) =~ s{\A $moose_dir/t }{$result}xmso;
+ (my $failing_test = $file) =~ s{\A $moose_dir/t }{$result-failing}xmso;
if( -d $_ ) {
- mkpath [$mouse_test, $mouse_failing_test];
+ mkpath [$test, $failing_test];
return;
}
- copy_as_mouse($_ => $mouse_test);
- push @tests, [$mouse_test, $mouse_failing_test]
- if $mouse_test =~/\.t\z/xms;
+ copy_as_mouse($_ => $test);
+ push @tests, [$test, $failing_test]
+ if $file =~/\.t\z/xms;
return;
}
say $out "# DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!!";
say $out 'use t::lib::MooseCompat;';
}
- s/\b Class::MOP::([a-z_]+) \b/Mouse::Util::$1/xmsg;
- s/\b Class::MOP \b /Mouse::Meta/xmsg;
- s/\b Moose \b/Mouse/xmsg;
+ s/ Class::MOP::([a-z_]+) /Mouse::Util::$1/xmsg;
+ s/ Class::MOP /Mouse::Meta/xmsg;
+ s/ Moose /Mouse/xmsg;
# make classes simple
s{\b(Mouse::Meta::TypeConstraint)::\w+ }{$1}xmsg;