10 use Scalar::Util 'blessed';
12 # Don't spew deprecation warnings onto the user's screen
14 $SIG{__WARN__} = sub { warn $_[0] if $_[0] !~ /Squirrel is deprecated/ };
19 use Squirrel; # load Mouse
29 # note that 'Foo' is defined before this, to prevent Moose being loaded from
30 # affecting its definition
32 eval{ require Moose && Moose->VERSION(Mouse::Spec->MooseVersion) };
33 plan skip_all => "Moose $Mouse::Spec::MooseVersion required for this test" if $@;
39 use Squirrel; # load Moose
49 my $foo = Foo->new(foo => 3);
51 isa_ok($foo, "Mouse::Object");
52 is($foo->foo, 3, "accessor");
54 my $bar = Bar->new(foo => 3);
56 isa_ok($bar, "Moose::Object");
57 is($bar->foo, 3, "accessor");
59 ok(!Foo->can('has'), "Mouse::has was unimported");
60 ok(!Bar->can('has'), "Moose::has was unimported");
66 has bar => (is => 'rw');
67 __PACKAGE__->meta->make_immutable;
72 has bar => (is => 'rw');
73 __PACKAGE__->meta->make_immutable;
77 is(blessed(Foo->meta->get_attribute('foo')), 'Mouse::Meta::Attribute');
78 is(blessed(Foo->meta->get_attribute('bar')), 'Mouse::Meta::Attribute', 'Squirrel is consistent if Moose was loaded between imports');
80 is(blessed(Bar->meta->get_attribute('foo')), 'Moose::Meta::Attribute');
81 is(blessed(Bar->meta->get_attribute('bar')), 'Moose::Meta::Attribute');