update repo to point to github
[gitmo/Moo.git] / xt / moo-object-meta-can.t
CommitLineData
904c9160 1use strictures 1;
f1bad247 2use Test::More;
3use Test::Fatal;
4use Moo::Object;
5
6# See RT#84615
7
8ok( Moo::Object->can('meta'), 'Moo::Object can meta');
9is( exception { Moo::Object->meta->can('can') } , undef, "Moo::Object->meta->can doesn't explode" );
10
11{
12 package Example;
13 use base 'Moo::Object';
14
15}
16
17ok( Example->can('meta'), 'Example can meta');
18is( exception { Example->meta->can('can') } , undef, "Example->meta->can doesn't explode" );
19
20# Haarg++ noting that previously, this *also* would have died due to its absence from %Moo::Makers;
21{
22 package Example_2;
23 use Moo;
24
25 has 'attr' => ( is => ro =>, );
26
27 $INC{'Example_2.pm'} = 1;
28}
29{
30 package Example_3;
31 use base "Example_2";
32}
33
904c9160 34ok( Example_2->can('meta'), 'Example_2 can meta') and do {
f1bad247 35 return unless ok( Example_2->meta->can('get_all_attributes'), 'Example_2 meta can get_all_attributes' );
36 my (@attributes) = Example_2->meta->get_all_attributes;
37 is( scalar @attributes, 1, 'Has one attribute' );
38};
39
904c9160 40ok( Example_3->can('meta'), 'Example_3 can meta') and do {
f1bad247 41 return unless is( exception { Example_3->meta->can('can') } , undef, "Example_3->meta->can doesn't explode" );
42 return unless ok( Example_3->meta->can('get_all_attributes'), 'Example_3 meta can get_all_attributes' );
43 my (@attributes) = Example_3->meta->get_all_attributes;
44 is( scalar @attributes, 1, 'Has one attribute' );
45};
46
47done_testing;