Commit | Line | Data |
c47cf415 |
1 | #!/usr/bin/perl |
2 | # This is automatically generated by author/import-moose-test.pl. |
3 | # DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!! |
4 | use t::lib::MooseCompat; |
5 | |
6 | use strict; |
7 | use warnings; |
8 | |
9 | use Test::More; |
10 | $TODO = q{Mouse is not yet completed}; |
11 | |
12 | BEGIN { |
13 | use_ok('Mouse::Util', ':all'); |
14 | } |
15 | |
16 | { |
17 | package Foo; |
18 | use Mouse::Role; |
19 | } |
20 | |
21 | { |
22 | package Bar; |
23 | use Mouse::Role; |
24 | } |
25 | |
26 | { |
27 | package Quux; |
28 | use Mouse; |
29 | } |
30 | |
31 | is_deeply( |
32 | Quux->meta->roles, |
33 | [], |
34 | "no roles yet", |
35 | ); |
36 | |
37 | Foo->meta->apply(Quux->meta); |
38 | |
39 | is_deeply( |
40 | Quux->meta->roles, |
41 | [ Foo->meta ], |
42 | "applied Foo", |
43 | ); |
44 | |
45 | Foo->meta->apply(Quux->meta); |
46 | Bar->meta->apply(Quux->meta); |
47 | is_deeply( |
48 | Quux->meta->roles, |
49 | [ Foo->meta, Foo->meta, Bar->meta ], |
50 | "duplicated Foo", |
51 | ); |
52 | |
53 | is(does_role('Quux', 'Foo'), 1, "Quux does Foo"); |
54 | is(does_role('Quux', 'Bar'), 1, "Quux does Bar"); |
55 | ensure_all_roles('Quux', qw(Foo Bar)); |
56 | is_deeply( |
57 | Quux->meta->roles, |
58 | [ Foo->meta, Foo->meta, Bar->meta ], |
59 | "unchanged, since all roles are already applied", |
60 | ); |
61 | |
62 | my $obj = Quux->new; |
63 | ensure_all_roles($obj, qw(Foo Bar)); |
64 | is_deeply( |
65 | $obj->meta->roles, |
66 | [ Foo->meta, Foo->meta, Bar->meta ], |
67 | "unchanged, since all roles are already applied", |
68 | ); |
69 | |
70 | done_testing; |