add mluti option with test
大沢 和宏 [Thu, 4 Dec 2008 07:54:01 +0000 (07:54 +0000)]
t/800_shikabased/007-multi-roles.t [new file with mode: 0644]

diff --git a/t/800_shikabased/007-multi-roles.t b/t/800_shikabased/007-multi-roles.t
new file mode 100644 (file)
index 0000000..b781855
--- /dev/null
@@ -0,0 +1,44 @@
+use strict;
+use warnings;
+use Test::More;
+
+plan skip_all => "Moose way 'with' function test" unless $ENV{MOUSE_DEVEL};
+plan tests => 2;
+
+{
+    package Requires;
+    use Mouse::Role;
+    requires 'foo';
+}
+
+{
+    package Method;
+    use Mouse::Role;
+
+    sub foo { 'ok' }
+}
+
+{
+    package Requires2;
+    use Mouse::Role;
+    requires 'bar';
+}
+
+{
+    package Method2;
+    use Mouse::Role;
+
+    sub foo { 'yep' }
+}
+
+
+{
+    package MyApp;
+    use Mouse;
+    with ('Requires2', 'Method2' => { alias => { foo => 'bar' } }, 'Requires', 'Method');
+}
+
+my $m = MyApp->new;
+is $m->foo, 'ok';
+is $m->bar, 'yep';
+