inlining for overloaded object isa/coerce
[gitmo/Moo.git] / xt / moose-override-attribute-with-plus-syntax.t
CommitLineData
47e5060c 1use strict;
2use warnings;
3use Test::More;
4use Test::Fatal;
5
6{
7 package MooParent;
8 use Moo;
9
10 has foo => (
11 is => 'ro',
12 default => sub { 'MooParent' },
13 );
14}
15{
16 package MooseChild;
17 use Moose;
18 extends 'MooParent';
19
20 has '+foo' => (
21 default => 'MooseChild',
22 );
23}
6e77b8df 24{
25 package MooseChild2;
26 use Moose;
27 extends 'MooParent';
28
29 has '+foo' => (
30 default => 'MooseChild2',
31 );
32 __PACKAGE__->meta->make_immutable
33}
47e5060c 34
35is(
36 MooseChild->new->foo,
37 'MooseChild',
38 'default value in Moose child'
39);
40
6e77b8df 41is(
42 MooseChild2->new->foo,
43 'MooseChild2',
44 'default value in Moose child'
45);
46
47e5060c 47done_testing;
48