%PDF- %PDF-
Direktori : /home/opti/optisoftcom/.cpanm/work/1544535406.20768/Role-Tiny-2.000006/t/ |
Current File : /home/opti/optisoftcom/.cpanm/work/1544535406.20768/Role-Tiny-2.000006/t/role-tiny-with.t |
use strict; use warnings; use Test::More; BEGIN { package MyRole; use Role::Tiny; sub bar { 'role bar' } sub baz { 'role baz' } } BEGIN { package MyClass; use Role::Tiny::With; with 'MyRole'; sub foo { 'class foo' } sub baz { 'class baz' } } is(MyClass->foo, 'class foo', 'method from class no override'); is(MyClass->bar, 'role bar', 'method from role'); is(MyClass->baz, 'class baz', 'method from class'); BEGIN { package RoleWithStub; use Role::Tiny; sub foo { 'role foo' } sub bar ($$); } { package ClassConsumeStub; use Role::Tiny::With; eval { with 'RoleWithStub'; }; } is $@, '', 'stub composed without error'; ok exists &ClassConsumeStub::bar && !defined &ClassConsumeStub::bar, 'stub exists in consuming class'; done_testing;