MXSC must be used by Moose classes, nothing else
[gitmo/MooseX-StrictConstructor.git] / t / basic.t
index f69201f..b159e77 100644 (file)
--- a/t/basic.t
+++ b/t/basic.t
@@ -80,6 +80,26 @@ use Test::More;
     has 'size'  => ( is => 'rw', 'init_arg' => undef );
 }
 
+{
+    local $@;
+    eval q[package MyRole; use Moose::Role; use MooseX::StrictConstructor;];
+    like(
+        $@,
+        qr/can only be applied to Moose classes/,
+        "can't apply MXSC to a role"
+    );
+}
+
+{
+    local $@;
+    eval q[package Nothing; use MooseX::StrictConstructor;];
+    like(
+        $@,
+        qr/can only be applied to Moose classes/,
+        "can't apply MXSC to a random package",
+    );
+}
+
 my @classes
     = qw( Standard Stricter Subclass StrictSubclass OtherStrictSubclass Tricky InitArg );