Cleanup failing tests
[gitmo/Mouse.git] / Moose-t-failing / 100_bugs / 024_anon_method_metaclass.t
CommitLineData
4c98ebb0 1use strict;
c47cf415 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;
4c98ebb0 5use warnings;
c47cf415 6use Test::More;
7$TODO = q{Mouse is not yet completed};
4c98ebb0 8
9{
10 package Ball;
11 use Mouse;
12}
13
14{
15 package Arbitrary::Roll;
16 use Mouse::Role;
17}
18
19my $method_meta = Mouse::Meta::Class->create_anon_class(
20 superclasses => ['Mouse::Meta::Method'],
21 roles => ['Arbitrary::Roll'],
22);
23
24# For comparing identity without actually keeping $original_meta around
25my $original_meta = "$method_meta";
26
27my $method_class = $method_meta->name;
28
29my $method_object = $method_class->wrap(
30 sub {'ok'},
31 associated_metaclass => Ball->meta,
32 package_name => 'Ball',
33 name => 'bounce',
34);
35
36Ball->meta->add_method( bounce => $method_object );
37
38for ( 1, 2 ) {
39 is( Ball->bounce, 'ok', "method still exists on Ball" );
40 is( Ball->meta->get_method('bounce')->meta->name, $method_class,
41 "method's package still exists" );
42
43 is( Ball->meta->get_method('bounce'), $method_object,
44 'original method object is preserved' );
45
46 is( Ball->meta->get_method('bounce')->meta . '', $original_meta,
47 "method's metaclass still exists" );
48 ok( Ball->meta->get_method('bounce')->meta->does_role('Arbitrary::Roll'),
49 "method still does Arbitrary::Roll" );
50
51 undef $method_meta;
52}
c47cf415 53
54done_testing;