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;
10 $TODO = q{Mouse is not yet completed};
15 The idea and examples for this feature are taken
16 from the Fortress spec.
18 http://research.sun.com/projects/plrg/fortress0903.pdf
20 trait OrganicMolecule extends Molecule
21 excludes { InorganicMolecule }
23 trait InorganicMolecule extends Molecule end
31 package Molecule::Organic;
35 excludes 'Molecule::Inorganic';
37 package Molecule::Inorganic;
43 ok(Molecule::Organic->meta->excludes_role('Molecule::Inorganic'), '... Molecule::Organic exludes Molecule::Inorganic');
45 [ Molecule::Organic->meta->get_excluded_roles_list() ],
46 [ 'Molecule::Inorganic' ],
47 '... Molecule::Organic exludes Molecule::Inorganic');
51 Check some basic conflicts when combining
52 the roles into the same class
61 with 'Molecule::Organic';
62 } '... adding the role (w/ excluded roles) okay';
68 with 'Molecule::Organic', 'Molecule::Inorganic';
69 } qr/Conflict detected: Role Molecule::Organic excludes role 'Molecule::Inorganic'/,
70 '... adding the role w/ excluded role conflict dies okay';
76 with 'Molecule::Organic';
77 } '... adding the role (w/ excluded roles) okay';
80 with 'Molecule::Inorganic';
81 } qr/Conflict detected: My::Test3 excludes role 'Molecule::Inorganic'/,
82 '... adding the role w/ excluded role conflict dies okay';
85 ok(My::Test1->does('Molecule::Organic'), '... My::Test1 does Molecule::Organic');
86 ok(My::Test1->does('Molecule'), '... My::Test1 does Molecule');
87 ok(My::Test1->meta->excludes_role('Molecule::Inorganic'), '... My::Test1 excludes Molecule::Organic');
89 ok(!My::Test2->does('Molecule::Organic'), '... ! My::Test2 does Molecule::Organic');
90 ok(!My::Test2->does('Molecule::Inorganic'), '... ! My::Test2 does Molecule::Inorganic');
92 ok(My::Test3->does('Molecule::Organic'), '... My::Test3 does Molecule::Organic');
93 ok(My::Test3->does('Molecule'), '... My::Test1 does Molecule');
94 ok(My::Test3->meta->excludes_role('Molecule::Inorganic'), '... My::Test3 excludes Molecule::Organic');
95 ok(!My::Test3->does('Molecule::Inorganic'), '... ! My::Test3 does Molecule::Inorganic');
99 Check some basic conflicts when combining
100 the roles into the a superclass
108 with 'Molecule::Organic';
116 with 'Molecule::Inorganic';
117 } qr/Conflict detected: My::Test4 excludes role \'Molecule::Inorganic\'/,
118 '... cannot add exculded role into class which extends Methane';
121 ok(Methane->does('Molecule::Organic'), '... Methane does Molecule::Organic');
122 ok(My::Test4->isa('Methane'), '... My::Test4 isa Methane');
123 ok(My::Test4->does('Molecule::Organic'), '... My::Test4 does Molecule::Organic');
124 ok(My::Test4->meta->does_role('Molecule::Organic'), '... My::Test4 meat does_role Molecule::Organic');
125 ok(My::Test4->meta->excludes_role('Molecule::Inorganic'), '... My::Test4 meta excludes Molecule::Organic');
126 ok(!My::Test4->does('Molecule::Inorganic'), '... My::Test4 does Molecule::Inorganic');