X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fmodifiers.t;h=6d90efb5e74f871b010ffe5bc5dfb3aa2012ba00;hb=291d3b5efe6b1d506946f55cec6bab1053e2cebe;hp=8a3e1f1360b8ed168dcb0a9ad136a525a50e2b60;hpb=06b06c8e8a98b4aca1168e5336a946bffba4431e;p=gitmo%2FRole-Tiny.git diff --git a/t/modifiers.t b/t/modifiers.t index 8a3e1f1..6d90efb 100644 --- a/t/modifiers.t +++ b/t/modifiers.t @@ -4,8 +4,8 @@ use Test::More; use Test::Fatal; BEGIN { - plan skip_all => "Class::Method::Modifiers not installed" - unless eval "use Class::Method::Modifiers; 1"; + plan skip_all => "Class::Method::Modifiers not installed or too old" + unless eval "use Class::Method::Modifiers 1.05; 1"; } BEGIN { @@ -45,6 +45,19 @@ BEGIN { around 'broken modifier' => sub { my $orig = shift; $orig->(@_) }; } +BEGIN { + package MyRole2; + use Role::Tiny; + with 'MyRole'; +} + +BEGIN { + package ExtraClass2; + use Role::Tiny::With; + with 'MyRole2'; + sub foo { 'class foo' } +} + sub try_apply_to { my $to = shift; exception { Role::Tiny->apply_role_to_package($to, 'MyRole') } @@ -54,6 +67,9 @@ is(try_apply_to('MyClass'), undef, 'role applies cleanly'); is(MyClass->foo, 'role foo class foo', 'method modifier'); is(ExtraClass->foo, 'role foo class foo', 'method modifier with composition'); +is(ExtraClass2->foo, 'role foo class foo', + 'method modifier with role composed into role'); + ok(exception { my $new_class = Role::Tiny->create_class_with_roles('MyClass', 'BrokenRole'); }, 'exception caught creating class with broken modifier in a role');