4 use Test::More 'no_plan';
17 use base 'Class::MOP::Class';
20 shift->SUPER::initialize(
22 immutable_trait => 'My::Meta::Class::Immutable::Trait',
28 package My::Meta::Class::Immutable::Trait;
31 use base 'Class::MOP::Class::Immutable::Trait';
33 sub another_method { 42 }
49 __PACKAGE__->meta->add_attribute('foo');
51 __PACKAGE__->meta->make_immutable;
59 use metaclass 'My::Meta';
63 __PACKAGE__->meta->add_attribute('bar');
65 ::lives_ok { __PACKAGE__->meta->make_immutable }
66 'can safely make a class immutable when it has a custom metaclass and immutable trait';
70 can_ok( Bar->meta, 'another_method' );
71 is( Bar->meta->another_method, 42, 'another_method returns expected value' );
73 [ Bar->meta->superclasses ], ['Foo'],
74 'Bar->meta->superclasses returns expected value after immutabilization'