Mouse::Util::does_role() respects $thing->does() method
[gitmo/Mouse.git] / t / 900_mouse_bugs / 009_RT57144.t
1 #!/usr/bin/perl
2 # https://rt.cpan.org/Public/Bug/Display.html?id=57144
3 use strict;
4 use Test::More;
5
6 package Hoge;
7 use Mouse;
8
9 has 'fuga' => (
10     is => 'rw',
11     isa => 'Str',
12     lazy_build => 1,
13 );
14
15 has 'hoge' => (
16     is => 'rw',
17     isa => 'Str',
18     lazy_build => 1,
19 );
20
21 sub _build_fuga {
22     shift->hoge;
23 }
24
25 sub _build_hoge {
26     eval "use Hoge::Hoge"; ## no critic
27     "HOGE";
28 }
29
30 sub msg {
31     shift->fuga;
32 }
33
34 package main;
35 use strict;
36 use warnings;
37
38 my $hoge = Hoge->new;
39 is $hoge->msg, "HOGE";
40
41 done_testing;