From: Shawn M Moore Date: Wed, 15 Apr 2009 20:57:26 +0000 (-0400) Subject: Make sure that role overrides work as specced X-Git-Tag: 0.22~1 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e743afa0bbebd48c178249e01aac35c4ae47f0b5;p=gitmo%2FMouse.git Make sure that role overrides work as specced --- diff --git a/t/404-role-overrides.t b/t/404-role-overrides.t new file mode 100644 index 0000000..8a46769 --- /dev/null +++ b/t/404-role-overrides.t @@ -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'); +