Constants _should_ be reported as methods.
[gitmo/Class-MOP.git] / t / 003_methods.t
index 1eaa655..53813db 100644 (file)
@@ -1,7 +1,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 70;
+use Test::More;
 use Test::Exception;
 
 use Scalar::Util qw/reftype/;
@@ -207,7 +207,6 @@ is_deeply(
 is( $Foo->remove_method('foo')->body, $foo, '... removed the foo method' );
 ok( !$Foo->has_method('foo'),
     '... !Foo->has_method(foo) we just removed it' );
-ok( !$Foo->get_method_map->{foo}, 'foo is not in the method map' );
 dies_ok { Foo->foo } '... cannot call Foo->foo because it is not there';
 
 is_deeply(
@@ -352,3 +351,31 @@ is( $new_method->original_method, $method,
         ok( $method, 'Got the foo method back' );
     }
 }
+
+{
+    package HasConstants;
+
+    use constant FOO => 1;
+    use constant BAR => [];
+    use constant BAZ => {};
+
+    sub quux  {1}
+    sub thing {1}
+}
+
+my $HC = Class::MOP::Class->initialize('HasConstants');
+
+is_deeply(
+    [ sort $HC->get_method_list ],
+    [qw( BAR BAZ FOO quux thing )],
+    'get_method_list handles constants properly'
+);
+
+is_deeply(
+    [ sort map { $_->name } $HC->_get_local_methods ],
+    [qw( BAR BAZ FOO quux thing )],
+    '_get_local_methods handles constants properly'
+);
+
+
+done_testing;