Add failing test for overriding default with '+attr'
Mark A. Stratman [Fri, 22 Jun 2012 20:21:21 +0000 (15:21 -0500)]
xt/moose-override-attribute-with-plus-syntax.t [new file with mode: 0644]

diff --git a/xt/moose-override-attribute-with-plus-syntax.t b/xt/moose-override-attribute-with-plus-syntax.t
new file mode 100644 (file)
index 0000000..e4b90c3
--- /dev/null
@@ -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;
+