X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMouse.git;a=blobdiff_plain;f=t%2F402-basic-role-application.t;h=1191d034243b475efc27e0dff4f5c4ab4b67d9cd;hp=89e2aee360dce7fc03a41f9ea2d2947b0b7cb0c8;hb=69ac1dcfa408b64733ba3d2e47e8e791e4548f95;hpb=2c09851498d4ec7bb7a166d08623b6599d16598f diff --git a/t/402-basic-role-application.t b/t/402-basic-role-application.t index 89e2aee..1191d03 100644 --- a/t/402-basic-role-application.t +++ b/t/402-basic-role-application.t @@ -1,17 +1,22 @@ #!/usr/bin/env perl use strict; use warnings; -use Test::More tests => 1; +use Test::More tests => 5; +use Test::Exception; do { package Role; use Mouse::Role; - has 'attr'; + has 'attr' => ( + default => 'Role', + ); no Mouse::Role; }; +is_deeply(Role->meta->get_attribute('attr'), {default => 'Role'}); + do { package Class; use Mouse; @@ -21,4 +26,28 @@ do { }; ok(Class->meta->has_attribute('attr'), "role application added the attribute"); +is(Class->meta->get_attribute('attr')->default, 'Role'); + +do { + package Role2; + use Mouse::Role; + + has 'attr' => ( + default => 'Role2', + ); + + no Mouse::Role; +}; + +lives_ok { + package Class2; + use Mouse; + with 'Role'; + with 'Role2'; +}; + +TODO: { + local $TODO = "Moose prefers first definition, Mouse the last"; + is(Class2->meta->get_attribute('attr')->default, 'Role'); +};