role support, in MooseX::StrictConstructor::FromRole
[gitmo/MooseX-StrictConstructor.git] / t / role.t
CommitLineData
98630abc 1use strict;
2use warnings;
3
4use Test::More;
5use Test::Fatal;
6use Test::Moose qw( with_immutable );
7
8{
9 package Role;
10
11 use Moose::Role;
12 use MooseX::StrictConstructor::FromRole;
13
14 has 'size' => ( is => 'rw' );
15}
16
17{
18 package Standard;
19
20 use Moose;
21 with 'Role';
22
23 has 'thing' => ( is => 'rw' );
24}
25
26my @classes = qw( Standard );
27with_immutable {
28
29 like(
30 exception { Standard->new( thing => 1, bad => 99 ) },
31 qr/unknown attribute.+: bad/,
32 'strict constructor applied from role blows up on unknown params'
33 );
34}
35@classes;
36
37done_testing();