test to make sure the errors in components of resultset classes are reported right.
Ash Berlin [Tue, 11 Mar 2008 14:38:10 +0000 (14:38 +0000)]
t/98source_load_error.t [new file with mode: 0644]
t/lib/DBICErrorTest/ResultSet/WithError.pm [new file with mode: 0644]
t/lib/DBICErrorTest/Schema/SourceWithError.pm [new file with mode: 0644]
t/lib/DBICErrorTest/SyntaxError.pm [new file with mode: 0644]

diff --git a/t/98source_load_error.t b/t/98source_load_error.t
new file mode 100644 (file)
index 0000000..620acda
--- /dev/null
@@ -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 (file)
index 0000000..5e7a913
--- /dev/null
@@ -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 (file)
index 0000000..af23af8
--- /dev/null
@@ -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 (file)
index 0000000..34f3c3f
--- /dev/null
@@ -0,0 +1,5 @@
+package DBICErrorTest::SyntaxError;
+
+use strict;
+
+I'm a syntax error!