Commit | Line | Data |
1ca8d984 |
1 | #!/usr/bin/perl |
2 | |
3 | use strict; |
4 | use warnings; |
5 | |
6 | use Test::More tests => 5; |
7 | use Test::Exception; |
8 | |
9 | |
10 | |
11 | { |
12 | package Foo; |
13 | use Mouse; |
14 | |
15 | has 'foo' => (is => 'rw', isa => 'Int'); |
16 | |
17 | sub DEMOLISH { } |
18 | } |
19 | |
20 | { |
21 | package Bar; |
22 | use Mouse; |
23 | |
24 | extends qw(Foo); |
25 | has 'bar' => (is => 'rw', isa => 'Int'); |
26 | |
27 | sub DEMOLISH { } |
28 | } |
29 | |
30 | lives_ok { |
31 | Bar->new(); |
32 | } 'Bar->new()'; |
33 | |
34 | lives_ok { |
35 | Bar->meta->make_immutable; |
36 | } 'Bar->meta->make_immutable'; |
37 | |
38 | is( Bar->meta->get_method('DESTROY')->package_name, 'Bar', |
39 | 'Bar has a DESTROY method in the Bar class (not inherited)' ); |
40 | |
41 | lives_ok { |
42 | Foo->meta->make_immutable; |
43 | } 'Foo->meta->make_immutable'; |
44 | |
45 | is( Foo->meta->get_method('DESTROY')->package_name, 'Foo', |
46 | 'Foo has a DESTROY method in the Bar class (not inherited)' ); |