1#!/usr/bin/env perl 2use strict; 3use warnings; 4use Test::More tests => 11; 5use Test::Exception; 6 7lives_ok { 8 package Role; 9 use Mouse::Role; 10 11 no Mouse::Role; 12}; 13 14throws_ok { 15 package Role; 16 use Mouse::Role; 17 18 extends 'Role::Parent'; 19 20 no Mouse::Role; 21} qr/Roles do not support 'extends'/; 22 23lives_ok { 24 package Role; 25 use Mouse::Role; 26 27 sub foo {} 28 29 no Mouse::Role; 30}; 31 32lives_ok { 33 package Role; 34 use Mouse::Role; 35 36 before foo => sub {}; 37 after foo => sub {}; 38 around foo => sub {}; 39 40 no Mouse::Role; 41}; 42 43lives_ok { 44 package Role; 45 use Mouse::Role; 46 47 has 'foo' => (is => 'bare'); 48 49 no Mouse::Role; 50}; 51 52do { 53 package Other::Role; 54 use Mouse::Role; 55 no Mouse::Role; 56}; 57 58lives_ok { 59 package Role; 60 use Mouse::Role; 61 62 with 'Other::Role'; 63 64 no Mouse::Role; 65}; 66 67TODO: { 68 package Role; 69 use Mouse::Role; 70 71 eval { 72 excludes 'excluded'; 73 }; 74 our $TODO; 75 local $TODO = "Mouse::Role does not currently support 'excludes'"; 76 ::ok(!$@, "excludes"); 77 78 no Mouse::Role; 79}; 80 81throws_ok { 82 package Role; 83 use Mouse::Role; 84 85 confess "Mouse::Role exports confess"; 86 87} qr/^Mouse::Role exports confess/; 88 89lives_ok { 90 package Role; 91 use Mouse::Role; 92 93 my $obj = bless {} => "Impromptu::Class"; 94 ::is(blessed($obj), "Impromptu::Class"); 95}; 96 97lives_ok{ 98 package Class; 99 use Mouse; 100 101 with 'Role', 'Other::Role'; 102}; 103 104