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