From: Dave Rolsky Date: Sat, 17 Sep 2011 02:25:22 +0000 (-0500) Subject: Account for UNIVERSAL methods X-Git-Tag: 2.0300~18 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=bcaddfbc61a58a2526d5adc896a75cd466f3d8c3;p=gitmo%2FMoose.git Account for UNIVERSAL methods Tweaked tests so failures are more informative. Also replaced several uses of get_method where we really needed find_next_method_by_name --- diff --git a/t/cmop/methods.t b/t/cmop/methods.t index 1f60918..df12337 100644 --- a/t/cmop/methods.t +++ b/t/cmop/methods.t @@ -185,11 +185,18 @@ is_deeply( '... got the right method list for Foo' ); +my @universal_methods = qw/isa can VERSION/; +push @universal_methods, 'DOES' if $] >= 5.010; + is_deeply( - [ sort { $a->name cmp $b->name } $Foo->get_all_methods() ], [ - map { $Foo->get_method($_) } - qw( + map { $_->name => $_ } + sort { $a->name cmp $b->name } $Foo->get_all_methods() + ], + [ + map { $_->name => $_ } + map { $Foo->find_method_by_name($_) } + sort qw( FOO_CONSTANT baaz bang @@ -201,7 +208,8 @@ is_deeply( floob foo pie - ) + ), + @universal_methods, ], '... got the right list of applicable methods for Foo' ); @@ -252,25 +260,32 @@ is_deeply( ); is_deeply( - [ sort { $a->name cmp $b->name } $Bar->get_all_methods() ], [ - $Foo->get_method('FOO_CONSTANT'), - $Foo->get_method('baaz'), - $Foo->get_method('bang'), - $Bar->get_method('bar'), - ( - map { $Foo->get_method($_) } - qw( - baz - blah - cake - evaled_foo - floob - ) - ), - $Bar->get_method('foo'), - $Bar->get_method('meta'), - $Foo->get_method('pie'), + map { $_->name => $_ } + sort { $a->name cmp $b->name } $Bar->get_all_methods() + ], + [ + map { $_->name => $_ } + sort { $a->name cmp $b->name } ( + $Foo->get_method('FOO_CONSTANT'), + $Foo->get_method('baaz'), + $Foo->get_method('bang'), + $Bar->get_method('bar'), + ( + map { $Foo->get_method($_) } + qw( + baz + blah + cake + evaled_foo + floob + ) + ), + $Bar->get_method('foo'), + $Bar->get_method('meta'), + $Foo->get_method('pie'), + ( map { $Bar->find_next_method_by_name($_) } @universal_methods ) + ) ], '... got the right list of applicable methods for Bar' );