Regenerate test files
[gitmo/Mouse.git] / t / 100_bugs / 028_apply_role_to_one_instance_only.t
CommitLineData
fde8e43f 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!!!
4use t::lib::MooseCompat;
5use strict;
6use warnings;
7use Test::More;
8$TODO = q{Mouse is not yet completed};
9use Test::Exception;
10
11{
12 package MyRole1;
13 use Mouse::Role;
14
15 sub a_role_method { 'foo' }
16}
17
18{
19 package MyRole2;
20 use Mouse::Role;
21 # empty
22}
23
24{
25 package Foo;
26 use Mouse;
27}
28
29my $instance_with_role1 = Foo->new;
30MyRole1->meta->apply($instance_with_role1);
31
32my $instance_with_role2 = Foo->new;
33MyRole2->meta->apply($instance_with_role2);
34
35ok ((not $instance_with_role2->does('MyRole1')),
36 'instance does not have the wrong role');
37
38ok ((not $instance_with_role2->can('a_role_method')),
39 'instance does not have methods from the wrong role');
40
41ok (($instance_with_role1->does('MyRole1')),
42 'role was applied to the correct instance');
43
44lives_and {
45 is $instance_with_role1->a_role_method, 'foo'
46} 'instance has correct role method';
47
48done_testing;