From: Mark A. Stratman Date: Fri, 22 Jun 2012 20:21:21 +0000 (-0500) Subject: Add failing test for overriding default with '+attr' X-Git-Tag: v0.091010~18 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=47e5060cbb0081640df91716827a4ed0408527bc;p=gitmo%2FMoo.git Add failing test for overriding default with '+attr' --- diff --git a/xt/moose-override-attribute-with-plus-syntax.t b/xt/moose-override-attribute-with-plus-syntax.t new file mode 100644 index 0000000..e4b90c3 --- /dev/null +++ b/xt/moose-override-attribute-with-plus-syntax.t @@ -0,0 +1,32 @@ +use strict; +use warnings; +use Test::More; +use Test::Fatal; + +{ + package MooParent; + use Moo; + + has foo => ( + is => 'ro', + default => sub { 'MooParent' }, + ); +} +{ + package MooseChild; + use Moose; + extends 'MooParent'; + + has '+foo' => ( + default => 'MooseChild', + ); +} + +is( + MooseChild->new->foo, + 'MooseChild', + 'default value in Moose child' +); + +done_testing; +