1#!perl 2use strict; 3use warnings; 4 5use Test::More; 6 7use Mouse::Util qw(does_role); 8 9{ 10 package FooTrait; 11 use Mouse::Role; 12 13 package BarTrait; 14 use Mouse::Role; 15 16 package BaseClass; 17 use Mouse -traits => qw(FooTrait); 18 19 package SubClass; 20 use Mouse -traits => qw(BarTrait); 21 22 extends qw(BaseClass); 23 24 package SubSubClass; 25 use Mouse; 26 27 extends qw(SubClass); 28} 29 30ok does_role(BaseClass->meta, 'FooTrait'), ' BaseClass->meta->does("FooTrait")'; 31ok!does_role(BaseClass->meta, 'BarTrait'), '!BaseClass->meta->does("BarTrait")'; 32 33ok does_role(SubClass->meta, 'FooTrait'), 'SubClass->meta->does("FooTrait")'; 34ok does_role(SubClass->meta, 'BarTrait'), 'SubClass->meta->does("BarTrait")'; 35 36ok does_role(SubSubClass->meta, 'FooTrait'), 'SubSubClass->meta->does("FooTrait")'; 37ok does_role(SubSubClass->meta, 'BarTrait'), 'SubSubClass->meta->does("BarTrait")'; 38 39done_testing; 40