From: Arthur Axel 'fREW' Schmidt Date: Tue, 3 Apr 2012 22:22:59 +0000 (-0500) Subject: add basic requires test X-Git-Tag: v0.009_015~22 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e7739ca4242b474333753b57c6030daa58d76d20;p=gitmo%2FMoo.git add basic requires test --- diff --git a/xt/handle_moose.t b/xt/handle_moose.t index 75400e5..34ea480 100644 --- a/xt/handle_moose.t +++ b/xt/handle_moose.t @@ -1,4 +1,5 @@ use strictures 1; +use Test::Exception; BEGIN { require "t/moo-accessors.t"; } @@ -24,4 +25,26 @@ my $spoon = Spoon->new(four => 4); is($spoon->four, 4, 'Role application ok'); +{ + package MooRequiresFour; + + use Moo::Role; + + requires 'four'; + + package MooRequiresGunDog; + + use Moo::Role; + + requires 'gun_dog'; +} + +lives_ok { + Moose::Util::apply_all_roles($meta, 'MooRequiresFour'); +} 'apply role with satisified requirement'; + +dies_ok { + Moose::Util::apply_all_roles($meta, 'MooRequiresGunDog'); +} 'apply role with unsatisified requirement'; + done_testing;