6 use Test::More tests => 14;
11 use_ok('Moose::Meta::Role');
16 our $VERSION = '0.01';
17 sub foo { 'FooRole::foo' }
24 #two checks because the inlined methods are different when
25 #there is a TC present.
26 has 'foos' => (is => 'ro', lazy_build => 1);
27 has 'bars' => (isa => 'Str', is => 'ro', lazy_build => 1);
28 sub _build_foos{ "many foos" }
29 sub _build_bars{ "many bars" }
33 my $foo_role = Moose::Meta::Role->initialize('FooRole');
36 lives_ok{ Foo->new } "lazy_build works";
37 is(Foo->new->foos, 'many foos' , "correct value for 'foos'");
38 is(Foo->new->bars, 'many bars' , "correct value for 'bars'");
39 lives_ok{ $meta->make_immutable } "Foo is imutable";
40 dies_ok{ $meta->add_role($foo_role) } "Add Role is locked";
41 lives_ok{ Foo->new } "Inlined constructor works with lazy_build";
42 is(Foo->new->foos, 'many foos' , "correct value for 'foos'");
43 is(Foo->new->bars, 'many bars' , "correct value for 'bars'");
44 lives_ok{ $meta->make_mutable } "Foo is mutable";
45 lives_ok{ $meta->add_role($foo_role) } "Add Role is unlocked";
69 lives_ok { Bar->meta->make_immutable }
70 'Immutable meta with single BUILD';
72 lives_ok { Baz->meta->make_immutable }
73 'Immutable meta with multiple BUILDs';
77 Nothing here yet, but soon :)