diff options
Diffstat (limited to 't/attributes/accessor_inlining.t')
-rw-r--r-- | t/attributes/accessor_inlining.t | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/t/attributes/accessor_inlining.t b/t/attributes/accessor_inlining.t new file mode 100644 index 0000000..8212e53 --- /dev/null +++ b/t/attributes/accessor_inlining.t @@ -0,0 +1,32 @@ +use strict; +use warnings; +use Test::More; + +my $called; +{ + package Foo::Meta::Instance; + use Moose::Role; + + sub is_inlinable { 0 } + + after get_slot_value => sub { $called++ }; +} + +{ + package Foo; + use Moose; + Moose::Util::MetaRole::apply_metaroles( + for => __PACKAGE__, + class_metaroles => { + instance => ['Foo::Meta::Instance'], + }, + ); + + has foo => (is => 'ro'); +} + +my $foo = Foo->new(foo => 1); +is($foo->foo, 1, "got the right value"); +is($called, 1, "reader was called"); + +done_testing; |