adding ->parent_registry to the TC registry object
[gitmo/Moose.git] / t / 300_immutable_moose.t
1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5
6 use Test::More tests => 8;
7 use Test::Exception;
8
9 BEGIN {
10     use_ok('Moose');
11     use_ok('Moose::Meta::Role');
12 }
13
14 {
15   package FooRole;
16   our $VERSION = '0.01';
17   sub foo { 'FooRole::foo' }
18 }
19
20 {
21   package Foo;
22   use Moose;
23 }
24
25 {
26   my $foo_role = Moose::Meta::Role->initialize('FooRole');
27   my $meta = Foo->meta;
28   lives_ok{ $meta->make_immutable       } "Foo is imutable";
29   dies_ok{  $meta->add_role($foo_role)  } "Add Role is locked";
30   lives_ok{ $meta->make_mutable         } "Foo is mutable";
31   lives_ok{ $meta->add_role($foo_role)  } "Add Role is unlocked";
32 }
33
34 {
35   package Bar;
36
37   use Moose;
38
39   sub BUILD { 'bar' }
40 }
41
42 {
43   package Baz;
44
45   use Moose;
46
47   extends 'Bar';
48
49   sub BUILD { 'baz' }
50 }
51
52 lives_ok { Bar->meta->make_immutable }
53   'Immutable meta with single BUILD';
54
55 lives_ok { Baz->meta->make_immutable }
56   'Immutable meta with multiple BUILDs';
57
58 =pod
59
60 Nothing here yet, but soon :)
61
62 =cut