X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fbasic.t;h=b159e77f769d51ed16191debcf471da597eb52e0;hb=topic%2Frole_support;hp=2a11bfca19cbd55ab6f63e9861df848823c55ea1;hpb=8834a28e7b417b9a759785bb99be3e36fa197080;p=gitmo%2FMooseX-StrictConstructor.git diff --git a/t/basic.t b/t/basic.t index 2a11bfc..b159e77 100644 --- 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 ); @@ -119,15 +139,15 @@ with_immutable { ); is( - exception { OtherStrictSubclass->new( thing => 1, size => 'large', ) } - , undef, - 'strict subclass from parent that doesn\'t use strict constructor handles known attributes correctly' + exception { OtherStrictSubclass->new( thing => 1, size => 'large', ) }, + undef, + q{strict subclass from parent that doesn't use strict constructor handles known attributes correctly} ); like( exception { OtherStrictSubclass->new( thing => 1, bad => 99 ) }, qr/unknown attribute.+: bad/, - 'strict subclass from parent that doesn\'t use strict correctly recognizes bad attribute' + q{strict subclass from parent that doesn't use strict correctly recognizes bad attribute} ); is(