Move t/*/t into t/001_mouse
[gitmo/Mouse.git] / t / 001_mouse / 035-apply-roles-to-roles.t
diff --git a/t/001_mouse/035-apply-roles-to-roles.t b/t/001_mouse/035-apply-roles-to-roles.t
new file mode 100644 (file)
index 0000000..bae8e0e
--- /dev/null
@@ -0,0 +1,33 @@
+use strict;
+use warnings;
+use Test::More tests => 5;
+
+{
+    package Animal;
+    use Mouse::Role;
+    requires 'bark';
+    sub eat { 'delicious' }
+    has food => ( is => 'ro' );
+}
+
+{
+    package Dog;
+    use Mouse::Role;
+    with 'Animal';
+}
+
+{
+    package Chihuahua;
+    use Mouse;
+    with 'Dog';
+    sub bark { 'bow-wow' }
+}
+
+ok !Animal->can('food');
+ok !Dog->can('food');
+
+my $c = Chihuahua->new(food => 'bone');
+is $c->eat(), 'delicious';
+is $c->food(), 'bone';
+is $c->bark(), 'bow-wow';
+