X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Frole-basic-composition.t;h=640dec72a6fdf75c64ef4f4366168f85022c3ebe;hb=032cad5623bf2534e576690015f746b74b0282c5;hp=69ce7e6464c2c8963edf0f829d895c46a3c374aa;hpb=f4afc2d19a9d70db4c7adb21f83f674d3f7e5f77;p=gitmo%2FRole-Tiny.git diff --git a/t/role-basic-composition.t b/t/role-basic-composition.t old mode 100755 new mode 100644 index 69ce7e6..640dec7 --- a/t/role-basic-composition.t +++ b/t/role-basic-composition.t @@ -1,5 +1,3 @@ -#!/usr/bin/env perl - use lib 'lib', 't/role-basic/lib'; use MyTests; require Role::Tiny; @@ -203,4 +201,35 @@ SKIP: { is $success, 1, 'composed diamantly dependent roles successfully' or diag "Error: $@"; } +{ + { + package My::Does::Conflict; + use Role::Tiny; + + sub method { + return __PACKAGE__ . " method"; + } + } + { + package My::Class::Base; + + sub turbo_charger { + return __PACKAGE__ . " turbo charger"; + } + sub method { + return __PACKAGE__ . " method"; + } + } + my $success = eval q{ + package My::Class::Child; + use base 'My::Class::Base'; + use Role::Tiny::With; + with qw/My::Does::Basic1 My::Does::Conflict/; + 1; + }; + is $success, 1, 'role conflict resolved by superclass method' or diag "Error: $@"; + can_ok 'My::Class::Child', 'method'; + is My::Class::Child->method, 'My::Class::Base method', 'inherited method prevails'; +} + done_testing;