Require Dist::Zilla 4.200016+
[gitmo/Moose.git] / t / attributes / accessor_inlining.t
1 #!/usr/bin/env perl
2 use strict;
3 use warnings;
4 use Test::More;
5
6 my $called;
7 {
8     package Foo::Meta::Instance;
9     use Moose::Role;
10
11     sub is_inlinable { 0 }
12
13     after get_slot_value => sub { $called++ };
14 }
15
16 {
17     package Foo;
18     use Moose;
19     Moose::Util::MetaRole::apply_metaroles(
20         for => __PACKAGE__,
21         class_metaroles => {
22             instance => ['Foo::Meta::Instance'],
23         },
24     );
25
26     has foo => (is => 'ro');
27 }
28
29 my $foo = Foo->new(foo => 1);
30 is($foo->foo, 1, "got the right value");
31 is($called, 1, "reader was called");
32
33 done_testing;