Test that subclassing looks at the superclass' attributes in the constructor (it...
Shawn M Moore [Wed, 11 Jun 2008 11:03:42 +0000 (11:03 +0000)]
t/028-subclass-attr.t [new file with mode: 0644]

diff --git a/t/028-subclass-attr.t b/t/028-subclass-attr.t
new file mode 100644 (file)
index 0000000..527e048
--- /dev/null
@@ -0,0 +1,27 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More tests => 2;
+
+do {
+    package Class;
+    use Mouse;
+
+    has class => (
+        is  => 'rw',
+        isa => 'Bool',
+    );
+
+    package Child;
+    use Mouse;
+    extends 'Class';
+
+    has child => (
+        is  => 'rw',
+        isa => 'Bool',
+    );
+};
+
+my $obj = Child->new(class => 1, child => 1);
+ok($obj->child, "local attribute set in constructor");
+ok($obj->class, "inherited attribute set in constructor");