One last tweak to make sure our Sub::Name-using tests _do_ run when we
[gitmo/Class-MOP.git] / t / 083_load_class.t
index 561c15f..dc3ed5a 100644 (file)
@@ -1,7 +1,7 @@
 #!/usr/bin/env perl
 use strict;
 use warnings;
-use Test::More tests => 11;
+use Test::More tests => 14;
 use Test::Exception;
 
 require Class::MOP;
@@ -15,7 +15,9 @@ throws_ok { Class::MOP::load_class()       } qr/Invalid class name \(undef\)/;
 throws_ok { Class::MOP::load_class('')     } qr/Invalid class name \(\)/;
 throws_ok { Class::MOP::load_class(\"foo") } qr/Invalid class name \(SCALAR\(\w+\)\)/;
 
-ok(Class::MOP::load_class('BinaryTree'));
+my $meta = Class::MOP::load_class('BinaryTree');
+ok($meta, "successfully loaded the class BinaryTree");
+is($meta->name, "BinaryTree", "load_class returns the metaclass");
 can_ok('BinaryTree' => 'traverse');
 
 do {
@@ -33,3 +35,9 @@ throws_ok {
     Class::MOP::load_class('SyntaxError');
 } qr/Missing right curly/;
 
+{
+    package Other;
+    use constant foo => "bar";
+}
+
+lives_ok { ok(Class::MOP::is_class_loaded("Other")) } "a class with just constants is still a class";