diff options
Diffstat (limited to 't/roles/create_role_subclass.t')
-rw-r--r-- | t/roles/create_role_subclass.t | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/t/roles/create_role_subclass.t b/t/roles/create_role_subclass.t new file mode 100644 index 0000000..c5795cb --- /dev/null +++ b/t/roles/create_role_subclass.t @@ -0,0 +1,26 @@ +use strict; +use warnings; +use Test::More; +use Moose (); + +do { + package My::Meta::Role; + use Moose; + extends 'Moose::Meta::Role'; + + has test_serial => ( + is => 'ro', + isa => 'Int', + default => 1, + ); + + no Moose; +}; + +my $role = My::Meta::Role->create_anon_role; +is($role->test_serial, 1, "default value for the serial attribute"); + +my $nine_role = My::Meta::Role->create_anon_role(test_serial => 9); +is($nine_role->test_serial, 9, "parameter value for the serial attribute"); + +done_testing; |