Commit | Line | Data |
bf8497ea |
1 | #!/usr/bin/perl |
2 | use strict; |
3 | use warnings; |
4 | use Test::More tests => 4; |
5 | use Test::Exception; |
6 | |
7 | { |
8 | package Role; |
9 | use Mouse::Role; |
10 | |
11 | sub rmethod{ |
12 | $_[0]->meta->throw_error('bar'); |
13 | } |
14 | |
15 | package Class; |
16 | use Mouse; |
17 | |
18 | with 'Role'; |
19 | |
20 | sub cmethod{ |
21 | $_[0]->meta->throw_error('foo'); |
22 | } |
23 | } |
24 | |
25 | |
26 | throws_ok { |
27 | Class->new->cmethod(); |
28 | } qr/\b foo \b/xms; |
29 | |
30 | throws_ok { |
31 | Class->cmethod(); |
32 | } qr/\b foo \b/xms; |
33 | |
34 | |
35 | |
36 | throws_ok { |
37 | Class->new->rmethod(); |
38 | } qr/\b bar \b/xms; |
39 | |
40 | throws_ok { |
41 | Class->rmethod(); |
42 | } qr/\b bar \b/xms; |
43 | |