2 # This is automatically generated by author/import-moose-test.pl.
3 # DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!!
4 use t::lib::MooseCompat;
8 $TODO = q{Mouse is not yet completed};
12 use Mouse::Meta::Role;
15 my $role1 = Mouse::Meta::Role->initialize('Foo');
16 $role1->add_attribute( foo => ( is => 'ro' ) );
18 ok( $role1->has_attribute('foo'), 'Foo role has a foo attribute' );
20 my $foo_attr = $role1->get_attribute('foo');
22 $foo_attr->associated_role->name, 'Foo',
23 'associated_role for foo attr is Foo role'
27 $foo_attr->attribute_for_class('Mouse::Meta::Attribute'),
28 'Mouse::Meta::Attribute',
29 'attribute returned by ->attribute_for_class'
32 my $role2 = Mouse::Meta::Role->initialize('Bar');
33 $role1->apply($role2);
35 ok( $role2->has_attribute('foo'), 'Bar role has a foo attribute' );
38 $foo_attr->associated_role->name, 'Foo',
39 'associated_role for foo attr is still Foo role'
43 $foo_attr->attribute_for_class('Mouse::Meta::Attribute'),
44 'Mouse::Meta::Attribute',
45 'attribute returned by ->attribute_for_class'
48 my $role3 = Mouse::Meta::Role->initialize('Baz');
49 my $combined = Mouse::Meta::Role->combine( [ $role1->name ], [ $role3->name ] );
51 ok( $combined->has_attribute('foo'), 'combined role has a foo attribute' );
54 $foo_attr->associated_role->name, 'Foo',
55 'associated_role for foo attr is still Foo role'