4 use Test::More 'no_plan';
16 my $map = Foo->meta->get_method_map;
18 is( scalar keys %{$map}, 2,
19 'method map for Foo has two key' );
20 ok( $map->{foo}, '... has a foo method in the map' );
21 ok( $map->{meta}, '... has a meta method in the map' );
25 Foo->meta->add_method( bar => sub { } );
28 my $map = Foo->meta->get_method_map;
29 is( scalar keys %{$map}, 3,
30 'method map for Foo has three keys' );
31 ok( $map->{foo}, '... has a foo method in the map' );
32 ok( $map->{bar}, '... has a bar method in the map' );
33 ok( $map->{meta}, '... has a meta method in the map' );
36 # Tests a bug where after a metaclass object was recreated, methods
37 # added via add_method were not showing up in the map, but only with
38 # the non-XS version of the code.
39 Class::MOP::remove_metaclass_by_name('Foo');
42 my $map = Foo->meta->get_method_map;
43 is( scalar keys %{$map}, 3,
44 'method map for Foo has three keys' );
45 ok( $map->{foo}, '... has a foo method in the map' );
46 ok( $map->{bar}, '... has a bar method in the map' );
47 ok( $map->{meta}, '... has a meta method in the map' );