Move t/*/t into t/001_mouse
[gitmo/Mouse.git] / t / 001_mouse / 036-with-method-alias.t
diff --git a/t/001_mouse/036-with-method-alias.t b/t/001_mouse/036-with-method-alias.t
new file mode 100644 (file)
index 0000000..9d0ca72
--- /dev/null
@@ -0,0 +1,45 @@
+use strict;
+use warnings;
+use Test::More tests => 6;
+
+{
+    package Animal;
+    use Mouse::Role;
+    sub eat { 'delicious' }
+}
+
+{
+    package Cat;
+    use Mouse::Role;
+    with 'Animal', {
+        -alias    => { eat => 'drink' },
+        -excludes => [qw(eat)],
+    };
+    sub eat { 'good!' }
+}
+
+{
+    package Tama;
+    use Mouse;
+    with 'Cat';
+}
+
+{
+    package Dog;
+    use Mouse;
+    with 'Animal', {
+        -alias    => { eat => 'drink' },
+    };
+}
+
+ok(Dog->can('eat'));
+ok(Dog->can('drink'));
+
+my $d = Dog->new();
+is($d->drink(), 'delicious');
+is($d->eat(),   'delicious');
+
+my $t = Tama->new;
+is $t->drink(), 'delicious';
+is $t->eat(),    'good!';
+