7 use Scalar::Util 'blessed';
21 # note that 'Foo' is defined before this, to prevent Moose being loaded from
22 # affecting its definition
25 plan skip_all => "Moose required for this test" unless eval { require Moose };
41 my $foo = Foo->new(foo => 3);
43 isa_ok($foo, "Mouse::Object");
44 is($foo->foo, 3, "accessor");
46 my $bar = Bar->new(foo => 3);
48 isa_ok($bar, "Moose::Object");
49 is($bar->foo, 3, "accessor");
51 ok(!Foo->can('has'), "Mouse::has was unimported");
52 ok(!Bar->can('has'), "Moose::has was unimported");
58 has bar => (is => 'rw');
59 __PACKAGE__->meta->make_immutable;
64 has bar => (is => 'rw');
65 __PACKAGE__->meta->make_immutable;
69 is(blessed(Foo->meta->get_attribute('foo')), 'Mouse::Meta::Attribute');
70 is(blessed(Foo->meta->get_attribute('bar')), 'Mouse::Meta::Attribute', 'Squirrel is consistent if Moose was loaded between imports');
72 is(blessed(Bar->meta->get_attribute('foo')), 'Moose::Meta::Attribute');
73 is(blessed(Bar->meta->get_attribute('bar')), 'Moose::Meta::Attribute');