4 use Test::More tests => 15;
12 predicate => 'has_pawn',
18 my $meta = Class->meta;
19 isa_ok($meta, 'Mouse::Meta::Class');
21 is_deeply([$meta->superclasses], ['Mouse::Object'], "correctly inherting from Mouse::Object");
23 my $meta2 = Class->meta;
24 is($meta, $meta2, "same metaclass instance");
26 can_ok($meta, 'name', 'get_attribute_map', 'get_attribute_list');
28 ok($meta->has_attribute('pawn'));
29 my $attr = $meta->get_attribute('pawn');
30 isa_ok($attr, 'Mouse::Meta::Attribute');
31 is($attr->name, 'pawn', 'got the correct attribute');
33 my $map = $meta->get_attribute_map;
34 is_deeply($map, { pawn => $attr }, "attribute map");
36 my $list = [$meta->get_attribute_list];
37 is_deeply($list, [ 'pawn' ], "attribute list");
39 ok(!$meta->has_attribute('nonexistent_attribute'));
47 my $meta3 = Class->meta;
48 is($meta, $meta3, "same metaclass instance, even if use Mouse is performed again");
50 is($meta->name, 'Class', "name for the metaclass");
58 my $child_meta = Child->meta;
59 isa_ok($child_meta, 'Mouse::Meta::Class');
61 isnt($meta, $child_meta, "different metaclass instances for the two classes");
63 is_deeply([$child_meta->superclasses], ['Class'], "correct superclasses");