Make sure that role overrides work as specced
Shawn M Moore [Wed, 15 Apr 2009 20:57:26 +0000 (16:57 -0400)]
t/404-role-overrides.t [new file with mode: 0644]

diff --git a/t/404-role-overrides.t b/t/404-role-overrides.t
new file mode 100644 (file)
index 0000000..8a46769
--- /dev/null
@@ -0,0 +1,35 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More tests => 2;
+
+do {
+    package My::Role;
+    use Mouse::Role;
+
+    sub foo { 'role' }
+
+    package Parent;
+    use Mouse;
+
+    sub foo { 'parent' }
+
+    package Child;
+    use Mouse;
+    extends 'Parent';
+    with 'My::Role';
+};
+
+is(Child->foo, 'role');
+
+do {
+    package ChildOverride;
+    use Mouse;
+    extends 'Parent';
+    with 'My::Role';
+
+    sub foo { 'child' }
+};
+
+is(ChildOverride->foo, 'child');
+