fix load_first_existing_class to die on an existing class that fails to compile
[gitmo/Class-MOP.git] / t / 083_load_class.t
index e93c427..7d9437b 100644 (file)
@@ -1,6 +1,6 @@
 use strict;
 use warnings;
-use Test::More tests => 33;
+use Test::More tests => 34;
 use Test::Exception;
 
 require Class::MOP;
@@ -51,6 +51,15 @@ throws_ok {
 qr/Missing right curly/;
 
 throws_ok {
+    delete $INC{'SyntaxError.pm'};
+    Class::MOP::load_first_existing_class(
+        'FakeClassOhNo', 'SyntaxError', 'Class'
+    );
+}
+qr/Missing right curly/, 
+    'load_first_existing_class does not pass over an existing (bad) module';
+
+throws_ok {
     Class::MOP::load_class('This::Does::Not::Exist');
 }
 qr/Could not load class \(This::Does::Not::Exist\) because :/,