new config option to DBICTest to let you set an alternative storage type, start on...
[dbsrgits/DBIx-Class.git] / t / 90ensure_class_loaded.t
index 4da8a75..3fc828e 100644 (file)
@@ -13,7 +13,7 @@ BEGIN {
 
 my $schema = DBICTest->init_schema();
 
-plan tests => 19;
+plan tests => 20;
 
 # Test ensure_class_found
 ok( $schema->ensure_class_found('DBIx::Class::Schema'),
@@ -63,10 +63,25 @@ ok( Class::Inspector->loaded('DBICTest::FakeComponent'),
       $warning =~ /Missing operator before/
     );
   };
-  eval { $schema->load_optional_class('DBICTest::SyntaxErrorComponent') };
-  like( $@, qr/syntax error/, 'DBICTest::ErrorComponent threw ok' );
-  eval { $schema->ensure_class_loaded('DBICTest::SyntaxErrorComponent') };
-  like( $@, qr/syntax error/, 'DBICTest::ErrorComponent threw ok' );
+
+  eval { $schema->ensure_class_loaded('DBICTest::SyntaxErrorComponent1') };
+  like( $@, qr/syntax error/,
+        'ensure_class_loaded(DBICTest::SyntaxErrorComponent1) threw ok' );
+  eval { $schema->load_optional_class('DBICTest::SyntaxErrorComponent2') };
+  like( $@, qr/syntax error/,
+        'load_optional_class(DBICTest::SyntaxErrorComponent2) threw ok' );
 }
 
+
+eval {
+  package Fake::ResultSet;
+
+  use base 'DBIx::Class::ResultSet';
+
+  __PACKAGE__->load_components('+DBICTest::SyntaxErrorComponent3');
+};
+
+# Make sure the errors in components of resultset classes are reported right.
+like($@, qr!\Qsyntax error at t/lib/DBICTest/SyntaxErrorComponent3.pm!, "Errors from RS components reported right");
+
 1;