A working first version.
[gitmo/MooseX-StrictConstructor.git] / t / basic.t
index d91d3c9..d06235f 100644 (file)
--- a/t/basic.t
+++ b/t/basic.t
@@ -1,7 +1,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 4;
+use Test::More tests => 6;
 
 
 {
@@ -21,6 +21,16 @@ use Test::More tests => 4;
 }
 
 {
+    package Subclass;
+
+    use MooseX::StrictConstructor;
+
+    extends 'Stricter';
+
+    has 'size' => ( is => 'rw' );
+}
+
+{
     package Tricky;
 
     use MooseX::StrictConstructor;
@@ -48,3 +58,9 @@ is( $@, '', 'can work around strict constructor by deleting params in BUILD()' )
 
 eval { Tricky->new( thing => 1, agent => 99 ) };
 like( $@, qr/unknown attribute.+: agent/, 'Tricky still blows up on unknown params other than spy' );
+
+eval { Subclass->new( thing => 1, bad => 99 ) };
+like( $@, qr/unknown attribute.+: bad/, 'subclass constructor blows up on unknown params' );
+
+eval { Subclass->new( thing => 1, size => 'large' ) };
+is( $@, '', 'subclass constructor handles known attributes correctly' );