4 use Test::More tests => 11;
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;
30 is( scalar keys %{$map}, 3,
31 'method map for Foo has three keys' );
32 ok( $map->{foo}, '... has a foo method in the map' );
33 ok( $map->{bar}, '... has a bar method in the map' );
34 ok( $map->{meta}, '... has a meta method in the map' );
37 # Tests a bug where after a metaclass object was recreated, methods
38 # added via add_method were not showing up in the map, but only with
39 # the non-XS version of the code.
40 Class::MOP::remove_metaclass_by_name('Foo');
43 my $map = Foo->meta->get_method_map;
45 is( scalar keys %{$map}, 3,
46 'method map for Foo has three keys' );
47 ok( $map->{foo}, '... has a foo method in the map' );
48 ok( $map->{bar}, '... has a bar method in the map' );
49 ok( $map->{meta}, '... has a meta method in the map' );