From: Arthur Axel 'fREW' Schmidt Date: Wed, 4 Jul 2012 20:42:05 +0000 (-0500) Subject: add failing tests for does_role + runtime applied roles X-Git-Tag: v1.001004~4 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=558f9dc9aacd60bfb50745eb9ded608f696596fc;p=gitmo%2FRole-Tiny.git add failing tests for does_role + runtime applied roles --- diff --git a/t/role-basic-bugs.t b/t/role-basic-bugs.t index baf35f5..571880f 100644 --- a/t/role-basic-bugs.t +++ b/t/role-basic-bugs.t @@ -50,4 +50,28 @@ use MyTests; or diag "Error found: $error"; } +{ + package Role1; + use Role::Tiny; + + package Role2; + use Role::Tiny; + + package Frew; + use strict; + use warnings; + sub new { bless {} => shift } + + my $object = Frew->new; + + ::ok(!Role::Tiny::does_role($object, 'Role1'), 'no Role1 yet'); + ::ok(!Role::Tiny::does_role($object, 'Role2'), 'no Role2 yet'); + + Role::Tiny->apply_roles_to_object($object, 'Role1'); + ::ok(Role::Tiny::does_role($object, "Role1"), 'Role1 consumed'); + ::ok(!Role::Tiny::does_role($object, 'Role2'), 'no Role2 yet'); + Role::Tiny->apply_roles_to_object($object, 'Role2'); + ::ok(Role::Tiny::does_role($object, "Role1"), 'Role1 consumed'); + ::ok(Role::Tiny::does_role($object, 'Role2'), 'Role2 consumed'); +} done_testing;