Commit | Line | Data |
1c3304e6 |
1 | #!/usr/bin/env perl |
2 | use strict; |
3 | use warnings; |
4 | use Test::More; |
5 | |
6 | { |
7 | # so we don't pick up stuff from Moose::Object |
8 | package Base; |
9 | sub foo { } # touch it so that 'extends' doesn't try to load it |
10 | } |
11 | |
12 | { |
13 | package Foo; |
14 | use Moose; |
15 | extends 'Base'; |
16 | no Moose; |
17 | } |
18 | can_ok('Foo', 'meta'); |
19 | is(Foo->meta, Class::MOP::class_of('Foo')); |
20 | isa_ok(Foo->meta->get_method('meta'), 'Moose::Meta::Method::Meta'); |
21 | |
22 | { |
23 | package Bar; |
24 | use Moose -meta_name => 'bar_meta'; |
25 | extends 'Base'; |
26 | no Moose; |
27 | } |
28 | ok(!Bar->can('meta')); |
29 | can_ok('Bar', 'bar_meta'); |
30 | is(Bar->bar_meta, Class::MOP::class_of('Bar')); |
31 | isa_ok(Bar->bar_meta->get_method('bar_meta'), 'Moose::Meta::Method::Meta'); |
32 | |
33 | { |
34 | package Baz; |
35 | use Moose -meta_name => undef; |
36 | extends 'Base'; |
37 | no Moose; |
38 | } |
39 | ok(!Baz->can('meta')); |
acf10496 |
40 | |
41 | my $universal_method_count = scalar Class::MOP::class_of('UNIVERSAL')->get_all_methods; |
1c3304e6 |
42 | # 1 because of the dummy method we installed in Base |
acf10496 |
43 | is( ( scalar Class::MOP::class_of('Baz')->get_all_methods ) |
44 | - $universal_method_count, 1 ); |
1c3304e6 |
45 | |
46 | done_testing; |