fix extending a constructor generator
[gitmo/Moo.git] / t / extend-constructor.t
diff --git a/t/extend-constructor.t b/t/extend-constructor.t
new file mode 100644 (file)
index 0000000..bae3a15
--- /dev/null
@@ -0,0 +1,29 @@
+use strictures 1;
+use Test::More;
+use Test::Fatal;
+
+BEGIN {
+  package Role::For::Constructor;
+  use Moo::Role;
+  has extra_param => (is => 'ro');
+}
+BEGIN {
+  package Some::Class;
+  use Moo;
+  BEGIN {
+    my $con = Moo->_constructor_maker_for(__PACKAGE__);
+    Moo::Role->apply_roles_to_object($con, 'Role::For::Constructor');
+  }
+}
+
+{
+  package Some::SubClass;
+  use Moo;
+  extends 'Some::Class';
+
+  ::is(::exception {
+    has bar => (is => 'ro');
+  }, undef, 'extending constructor generator works');
+}
+
+done_testing;