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