7 use Scalar::Util 'blessed';
9 # Don't spew deprecation warnings onto the user's screen
11 $SIG{__WARN__} = sub { warn $_[0] if $_[0] !~ /Squirrel is deprecated/ };
26 # note that 'Foo' is defined before this, to prevent Moose being loaded from
27 # affecting its definition
30 plan skip_all => "Moose 0.68 required for this test" unless eval { require Moose && Moose->VERSION('0.68') };
46 my $foo = Foo->new(foo => 3);
48 isa_ok($foo, "Mouse::Object");
49 is($foo->foo, 3, "accessor");
51 my $bar = Bar->new(foo => 3);
53 isa_ok($bar, "Moose::Object");
54 is($bar->foo, 3, "accessor");
56 ok(!Foo->can('has'), "Mouse::has was unimported");
57 ok(!Bar->can('has'), "Moose::has was unimported");
63 has bar => (is => 'rw');
64 __PACKAGE__->meta->make_immutable;
69 has bar => (is => 'rw');
70 __PACKAGE__->meta->make_immutable;
74 is(blessed(Foo->meta->get_attribute('foo')), 'Mouse::Meta::Attribute');
75 is(blessed(Foo->meta->get_attribute('bar')), 'Mouse::Meta::Attribute', 'Squirrel is consistent if Moose was loaded between imports');
77 is(blessed(Bar->meta->get_attribute('foo')), 'Moose::Meta::Attribute');
78 is(blessed(Bar->meta->get_attribute('bar')), 'Moose::Meta::Attribute');