From: Ash Berlin <ash_github@firemirror.com>
Date: Tue, 11 Mar 2008 14:38:10 +0000 (+0000)
Subject: test to make sure the errors in components of resultset classes are reported right.
X-Git-Tag: v0.08240~536
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c9d5a2518ae33434e8eac9bc636073d0e5316587;p=dbsrgits%2FDBIx-Class.git

test to make sure the errors in components of resultset classes are reported right.
---

diff --git a/t/98source_load_error.t b/t/98source_load_error.t
new file mode 100644
index 0000000..620acda
--- /dev/null
+++ b/t/98source_load_error.t
@@ -0,0 +1,15 @@
+use strict;
+use warnings;
+
+use Test::More tests => 1;
+
+use lib qw(t/lib);
+eval {
+  package DBICErrorTest::Schema;
+
+  use base 'DBIx::Class::Schema';
+  __PACKAGE__->load_classes('SourceWithError');
+};
+
+# Make sure the errors in components of resultset classes are reported right.
+like($@, qr!syntax error at t/lib/DBICErrorTest/SyntaxError.pm!);
diff --git a/t/lib/DBICErrorTest/ResultSet/WithError.pm b/t/lib/DBICErrorTest/ResultSet/WithError.pm
new file mode 100644
index 0000000..5e7a913
--- /dev/null
+++ b/t/lib/DBICErrorTest/ResultSet/WithError.pm
@@ -0,0 +1,10 @@
+package DBICErrorTest::ResultSet::WithError;
+
+use strict;
+use warnings;
+
+use base 'DBIx::Class::ResultSet';
+
+__PACKAGE__->load_components('+DBICErrorTest::SyntaxError');
+
+1;
diff --git a/t/lib/DBICErrorTest/Schema/SourceWithError.pm b/t/lib/DBICErrorTest/Schema/SourceWithError.pm
new file mode 100644
index 0000000..af23af8
--- /dev/null
+++ b/t/lib/DBICErrorTest/Schema/SourceWithError.pm
@@ -0,0 +1,13 @@
+package DBICErrorTest::Schema::SourceWithError;
+
+use strict;
+use warnings;
+
+use base 'DBIx::Class';
+__PACKAGE__->load_components('Core');
+__PACKAGE__->table('foo');
+#__PACKAGE__->load_components('+DBICErrorTest::SyntaxError');
+require DBICErrorTest::ResultSet::WithError;
+__PACKAGE__->resultset_class('DBICErrorTest::ResultSet::WithError');
+
+1;
diff --git a/t/lib/DBICErrorTest/SyntaxError.pm b/t/lib/DBICErrorTest/SyntaxError.pm
new file mode 100644
index 0000000..34f3c3f
--- /dev/null
+++ b/t/lib/DBICErrorTest/SyntaxError.pm
@@ -0,0 +1,5 @@
+package DBICErrorTest::SyntaxError;
+
+use strict;
+
+I'm a syntax error!