Commit | Line | Data |
---|---|---|
995061c2 | 1 | #!/usr/bin/env perl |
2 | use strict; | |
3 | use warnings; | |
59089ec3 | 4 | use Test::More tests => 11; |
eab81545 | 5 | use Test::Exception; |
995061c2 | 6 | |
7 | lives_ok { | |
8 | package Role; | |
9 | use Mouse::Role; | |
10 | ||
11 | no Mouse::Role; | |
12 | }; | |
13 | ||
8da998d9 | 14 | throws_ok { |
15 | package Role; | |
16 | use Mouse::Role; | |
17 | ||
18 | extends 'Role::Parent'; | |
964eaf79 | 19 | |
20 | no Mouse::Role; | |
b32e8fb9 | 21 | } qr/Roles do not support 'extends'/; |
8da998d9 | 22 | |
72381201 | 23 | lives_ok { |
24 | package Role; | |
25 | use Mouse::Role; | |
26 | ||
27 | sub foo {} | |
26482d3f | 28 | |
29 | no Mouse::Role; | |
72381201 | 30 | }; |
31 | ||
32 | lives_ok { | |
33 | package Role; | |
34 | use Mouse::Role; | |
35 | ||
36 | before foo => sub {}; | |
37 | after foo => sub {}; | |
38 | around foo => sub {}; | |
26482d3f | 39 | |
40 | no Mouse::Role; | |
41 | }; | |
42 | ||
43 | lives_ok { | |
44 | package Role; | |
45 | use Mouse::Role; | |
46 | ||
47 | has 'foo'; | |
48 | ||
49 | no Mouse::Role; | |
72381201 | 50 | }; |
51 | ||
00c0e9c2 | 52 | do { |
53 | package Other::Role; | |
54 | use Mouse::Role; | |
55 | no Mouse::Role; | |
56 | }; | |
57 | ||
b1b81553 | 58 | lives_ok { |
00c0e9c2 | 59 | package Role; |
60 | use Mouse::Role; | |
61 | ||
62 | with 'Other::Role'; | |
63 | ||
64 | no Mouse::Role; | |
b1b81553 | 65 | }; |
00c0e9c2 | 66 | |
2badb84a | 67 | throws_ok { |
eb812bde | 68 | package Role; |
69 | use Mouse::Role; | |
70 | ||
eb812bde | 71 | excludes 'excluded'; |
72 | ||
73 | no Mouse::Role; | |
2badb84a | 74 | } qr/Mouse::Role does not currently support 'excludes'/; |
eb812bde | 75 | |
4377514b | 76 | throws_ok { |
77 | package Role; | |
78 | use Mouse::Role; | |
79 | ||
80 | confess "Mouse::Role exports confess"; | |
81 | ||
82 | } qr/^Mouse::Role exports confess/; | |
83 | ||
84 | lives_ok { | |
85 | package Role; | |
86 | use Mouse::Role; | |
87 | ||
88 | my $obj = bless {} => "Impromptu::Class"; | |
89 | ::is(blessed($obj), "Impromptu::Class"); | |
90 | }; | |
91 | ||
21498b08 | 92 | our $TODO = 'skip'; |
b3bfbec3 | 93 | throws_ok { |
94 | package Class; | |
95 | use Mouse; | |
96 | ||
97 | with 'Role', 'Other::Role'; | |
98 | } qr/Mouse::Role only supports 'with' on individual roles at a time/; | |
99 |