From: Shawn M Moore Date: Tue, 17 Jun 2008 02:40:57 +0000 (+0000) Subject: Test that before/after/around live, and defining a sub within a role X-Git-Tag: 0.19~314 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=72381201e89a8afbff9b01f62f49240fd9c96789;p=gitmo%2FMouse.git Test that before/after/around live, and defining a sub within a role --- diff --git a/lib/Mouse/Role.pm b/lib/Mouse/Role.pm index ddd435a..89a44c7 100644 --- a/lib/Mouse/Role.pm +++ b/lib/Mouse/Role.pm @@ -15,6 +15,15 @@ do { confess "Role does not currently support 'extends'"; } }, + before => sub { + return sub { } + }, + after => sub { + return sub { } + }, + around => sub { + return sub { } + }, ); my $exporter = Sub::Exporter::build_exporter({ diff --git a/t/400-define-role.t b/t/400-define-role.t index 7ece4ec..0920e35 100644 --- a/t/400-define-role.t +++ b/t/400-define-role.t @@ -1,7 +1,7 @@ #!/usr/bin/env perl use strict; use warnings; -use Test::More tests => 2; +use Test::More tests => 4; use Test::Exception; lives_ok { @@ -20,3 +20,19 @@ throws_ok { no Mouse::Role; } qr/Role does not currently support 'extends'/; +lives_ok { + package Role; + use Mouse::Role; + + sub foo {} +}; + +lives_ok { + package Role; + use Mouse::Role; + + before foo => sub {}; + after foo => sub {}; + around foo => sub {}; +}; +