From: Graham Knop Date: Thu, 11 Jul 2013 08:53:01 +0000 (-0400) Subject: test to confirm when we don't use backcompat code X-Git-Tag: v1.003000~10 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=04d32ee770ad9cf36b2ec43a0fe5dbed8729b4da;p=gitmo%2FRole-Tiny.git test to confirm when we don't use backcompat code --- diff --git a/t/subclass.t b/t/subclass.t index 85cdacd..14a4e27 100644 --- a/t/subclass.t +++ b/t/subclass.t @@ -14,6 +14,21 @@ my $backcompat_called; $backcompat_called++; } } +{ + package RoleExtension2; + use base 'Role::Tiny'; + + sub role_application_steps { + $_[0]->SUPER::role_application_steps; + } + + sub apply_single_role_to_package { + my $me = shift; + $me->SUPER::apply_single_role_to_package(@_); + $backcompat_called++; + } + +} { package Role1; @@ -37,4 +52,12 @@ my $backcompat_called; is $backcompat_called, 2, 'overridden apply_single_role_to_package called for backcompat'; +$backcompat_called = 0; +{ + package Class2; + RoleExtension2->apply_roles_to_package(__PACKAGE__, 'Role1', 'Role2'); +} +is $backcompat_called, 0, + 'overridden role_application_steps prevents backcompat attempt'; + done_testing;