6 use Test::More tests => 11;
14 package Foo::Meta::Attribute;
18 use base 'Moose::Meta::Attribute';
22 $class->SUPER::new(@_, (is => 'rw', isa => 'Foo'));
30 has 'foo' => (metaclass => 'Foo::Meta::Attribute');
36 my $foo_attr = Foo->meta->get_attribute('foo');
37 isa_ok($foo_attr, 'Foo::Meta::Attribute');
38 isa_ok($foo_attr, 'Moose::Meta::Attribute');
40 is($foo_attr->name, 'foo', '... got the right name for our meta-attribute');
41 ok($foo_attr->has_accessor, '... our meta-attrubute created the accessor for us');
43 ok($foo_attr->has_type_constraint, '... our meta-attrubute created the type_constraint for us');
45 my $foo_attr_type_constraint = $foo_attr->type_constraint;
46 isa_ok($foo_attr_type_constraint, 'Moose::Meta::TypeConstraint');
48 is($foo_attr_type_constraint->name, 'Foo', '... got the right type constraint name');
49 is($foo_attr_type_constraint->parent->name, 'Object', '... got the right type constraint parent name');
52 package Bar::Meta::Attribute;
56 use base 'Class::MOP::Attribute';
64 has 'bar' => (metaclass => 'Bar::Meta::Attribute');
65 } '... the attribute metaclass must be a subclass of Moose::Meta::Attribute';