Mouse::Util::does_role() respects $thing->does() method
[gitmo/Mouse.git] / t / 100_bugs / 022_role_caller.t
1 package MyRole;
2 # This is automatically generated by author/import-moose-test.pl.
3 # DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!!
4 use t::lib::MooseCompat;
5
6 use Mouse::Role;
7
8 sub foo { return (caller(0))[3] }
9
10 no Mouse::Role;
11
12 package MyClass1; use Mouse; with 'MyRole'; no Mouse;
13 package MyClass2; use Mouse; with 'MyRole'; no Mouse;
14
15 package main;
16
17 use Test::More;
18
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
27 isnt(MyClass1->foo, "MyClass2::foo", "role method is not confused with other class" );
28 isnt(MyClass2->foo, "MyClass1::foo", "role method is not confused with other class" );
29
30 done_testing;