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