Failing test for mixing in a method from a role
Shawn M Moore [Sun, 28 Sep 2008 23:48:18 +0000 (23:48 +0000)]
t/404-methods.t [new file with mode: 0644]

diff --git a/t/404-methods.t b/t/404-methods.t
new file mode 100644 (file)
index 0000000..f3d4553
--- /dev/null
@@ -0,0 +1,40 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More;
+BEGIN {
+    if (eval "require Class::Method::Modifiers; 1") {
+        plan tests => 1;
+    }
+    else {
+        plan skip_all => "Class::Method::Modifiers required for this test";
+    }
+}
+use Mouse::Util ':test';
+
+my @calls;
+
+do {
+    package Role;
+    use Mouse::Role;
+
+    sub method {
+        push @calls, 'Role::method';
+    };
+
+    no Mouse::Role;
+};
+
+do {
+    package Class;
+    use Mouse;
+    with 'Role';
+
+    no Mouse;
+};
+
+Class->method;
+is_deeply([splice @calls], [
+    'Role::method',
+]);
+