Mouse::Util::does_role() respects $thing->does() method
[gitmo/Mouse.git] / t / 300_immutable / 005_multiple_demolish_inline.t
1 #!/usr/bin/perl
2 # This is automatically generated by author/import-moose-test.pl.
3 # DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!!
4 use t::lib::MooseCompat;
5
6 use strict;
7 use warnings;
8
9 use Test::More;
10 use Test::Exception;
11
12
13 {
14     package Foo;
15     use Mouse;
16
17     has 'foo' => (is => 'rw', isa => 'Int');
18
19     sub DEMOLISH { }
20 }
21
22 {
23     package Bar;
24     use Mouse;
25
26     extends qw(Foo);
27     has 'bar' => (is => 'rw', isa => 'Int');
28
29     sub DEMOLISH { }
30 }
31
32 lives_ok {
33     Bar->new();
34 } 'Bar->new()';
35
36 lives_ok {
37     Bar->meta->make_immutable;
38 } 'Bar->meta->make_immutable';
39
40 is( Bar->meta->get_method('DESTROY')->package_name, 'Bar',
41     'Bar has a DESTROY method in the Bar class (not inherited)' );
42
43 lives_ok {
44     Foo->meta->make_immutable;
45 } 'Foo->meta->make_immutable';
46
47 is( Foo->meta->get_method('DESTROY')->package_name, 'Foo',
48     'Foo has a DESTROY method in the Bar class (not inherited)' );
49
50 done_testing;