Add another MOOSE_TEST_MD option, MooseX
[gitmo/Moose.git] / t / roles / reinitialize_anon_role.t
1 #!/usr/bin/env perl
2 use strict;
3 use warnings;
4 use Test::More;
5
6 {
7     package Role::Metarole;
8     use Moose::Role;
9 }
10
11 my ($role2);
12 {
13     my $role1 = Moose::Meta::Role->create_anon_role(
14         methods => {
15             foo => sub { },
16         },
17     );
18     ok($role1->has_method('foo'), "role has method foo");
19     $role2 = Moose::Util::MetaRole::apply_metaroles(
20         for => $role1->name,
21         role_metaroles => { role => ['Role::Metarole'] },
22     );
23     isnt($role1, $role2, "anon role was reinitialized");
24     is($role1->name, $role2->name, "but it's the same anon role");
25     is_deeply([sort $role2->get_method_list], ['foo', 'meta'],
26               "has the right methods");
27 }
28 is_deeply([sort $role2->get_method_list], ['foo', 'meta'],
29           "still has the right methods");
30
31 done_testing;