summaryrefslogtreecommitdiff
path: root/t/bugs/role_caller.t
blob: 6fdf5a1db7a561cc56ec96260d10af7baa3ae9b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use strict;
use warnings;

package MyRole;

use Moose::Role;

sub foo { return (caller(0))[3] }

no Moose::Role;

package MyClass1; use Moose; with 'MyRole'; no Moose;
package MyClass2; use Moose; with 'MyRole'; no Moose;

package main;

use Test::More;

{
  local $TODO = 'Role composition does not clone methods yet';
  is(MyClass1->foo, 'MyClass1::foo',
    'method from role has correct name in caller()');
  is(MyClass2->foo, 'MyClass2::foo',
    'method from role has correct name in caller()');
}

isnt(MyClass1->foo, "MyClass2::foo", "role method is not confused with other class" );
isnt(MyClass2->foo, "MyClass1::foo", "role method is not confused with other class" );

done_testing;