Mouse::Util::does_role() respects $thing->does() method
[gitmo/Mouse.git] / t / 100_bugs / 022_role_caller.t
CommitLineData
4c98ebb0 1package MyRole;
ee5e6a03 2# This is automatically generated by author/import-moose-test.pl.
3# DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!!
4use t::lib::MooseCompat;
4c98ebb0 5
6use Mouse::Role;
7
8sub foo { return (caller(0))[3] }
9
10no Mouse::Role;
11
12package MyClass1; use Mouse; with 'MyRole'; no Mouse;
13package MyClass2; use Mouse; with 'MyRole'; no Mouse;
14
15package main;
16
ee5e6a03 17use Test::More;
18
4c98ebb0 19{
20 local $TODO = 'Role composition does not clone methods yet';
21 is(MyClass1->foo, 'MyClass1::foo',
22 'method from role has correct name in caller()');
23 is(MyClass2->foo, 'MyClass2::foo',
24 'method from role has correct name in caller()');
25}
26
27isnt(MyClass1->foo, "MyClass2::foo", "role method is not confused with other class" );
28isnt(MyClass2->foo, "MyClass1::foo", "role method is not confused with other class" );
ee5e6a03 29
30done_testing;