Add more words to the spelling whitelist
[gitmo/Moose.git] / t / immutable / apply_roles_to_immutable.t
1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5
6 use Test::More;
7 use Test::Fatal;
8
9
10 {
11     package My::Role;
12     use Moose::Role;
13
14     around 'baz' => sub {
15         my $next = shift;
16         'My::Role::baz(' . $next->(@_) . ')';
17     };
18 }
19
20 {
21     package Foo;
22     use Moose;
23
24     sub baz { 'Foo::baz' }
25
26     __PACKAGE__->meta->make_immutable(debug => 0);
27 }
28
29 my $foo = Foo->new;
30 isa_ok($foo, 'Foo');
31
32 is($foo->baz, 'Foo::baz', '... got the right value');
33
34 is( exception {
35     My::Role->meta->apply($foo)
36 }, undef, '... successfully applied the role to immutable instance' );
37
38 is($foo->baz, 'My::Role::baz(Foo::baz)', '... got the right value');
39
40 done_testing;