[Bast-commits] r4170 - in DBIx-Class/0.08/trunk: . lib/DBIx/Class t t/lib t/lib/DBICTest

ash at dev.catalyst.perl.org ash at dev.catalyst.perl.org
Tue Mar 11 15:03:36 GMT 2008


Author: ash
Date: 2008-03-11 15:03:34 +0000 (Tue, 11 Mar 2008)
New Revision: 4170

Added:
   DBIx-Class/0.08/trunk/t/lib/DBICTest/SyntaxErrorComponent3.pm
Removed:
   DBIx-Class/0.08/trunk/t/98source_load_error.t
   DBIx-Class/0.08/trunk/t/lib/DBICErrorTest/
Modified:
   DBIx-Class/0.08/trunk/Changes
   DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSet.pm
   DBIx-Class/0.08/trunk/t/90ensure_class_loaded.t
Log:
Fix errors from resultset components (and move tests into t/90ensure_class_loaded since its testing same sort of things)

Modified: DBIx-Class/0.08/trunk/Changes
===================================================================
--- DBIx-Class/0.08/trunk/Changes	2008-03-11 14:38:10 UTC (rev 4169)
+++ DBIx-Class/0.08/trunk/Changes	2008-03-11 15:03:34 UTC (rev 4170)
@@ -3,6 +3,7 @@
         - is_deferable support on relations used by the SQL::Translator
           parser (Anders Nor Berle)
         - Refactored DBIx::Class::Schema::Versioned
+        - Syntax errors from resultset components are now reported correctly
 
 0.08010 2008-03-01 10:30
         - Fix t/94versioning.t so it passes with latest SQL::Translator

Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSet.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSet.pm	2008-03-11 14:38:10 UTC (rev 4169)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSet.pm	2008-03-11 15:03:34 UTC (rev 4170)
@@ -2132,7 +2132,12 @@
 
 sub throw_exception {
   my $self=shift;
-  $self->_source_handle->schema->throw_exception(@_);
+  if (ref $self) {
+    $self->_source_handle->schema->throw_exception(@_)
+  } else {
+    croak(@_);
+  }
+
 }
 
 # XXX: FIXME: Attributes docs need clearing up

Modified: DBIx-Class/0.08/trunk/t/90ensure_class_loaded.t
===================================================================
--- DBIx-Class/0.08/trunk/t/90ensure_class_loaded.t	2008-03-11 14:38:10 UTC (rev 4169)
+++ DBIx-Class/0.08/trunk/t/90ensure_class_loaded.t	2008-03-11 15:03:34 UTC (rev 4170)
@@ -13,7 +13,7 @@
 
 my $schema = DBICTest->init_schema();
 
-plan tests => 19;
+plan tests => 20;
 
 # Test ensure_class_found
 ok( $schema->ensure_class_found('DBIx::Class::Schema'),
@@ -72,4 +72,16 @@
         '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;

Deleted: DBIx-Class/0.08/trunk/t/98source_load_error.t
===================================================================
--- DBIx-Class/0.08/trunk/t/98source_load_error.t	2008-03-11 14:38:10 UTC (rev 4169)
+++ DBIx-Class/0.08/trunk/t/98source_load_error.t	2008-03-11 15:03:34 UTC (rev 4170)
@@ -1,15 +0,0 @@
-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!);

Copied: DBIx-Class/0.08/trunk/t/lib/DBICTest/SyntaxErrorComponent3.pm (from rev 4169, DBIx-Class/0.08/trunk/t/lib/DBICErrorTest/SyntaxError.pm)
===================================================================
--- DBIx-Class/0.08/trunk/t/lib/DBICTest/SyntaxErrorComponent3.pm	                        (rev 0)
+++ DBIx-Class/0.08/trunk/t/lib/DBICTest/SyntaxErrorComponent3.pm	2008-03-11 15:03:34 UTC (rev 4170)
@@ -0,0 +1,5 @@
+package DBICErrorTest::SyntaxError;
+
+use strict;
+
+I'm a syntax error!




More information about the Bast-commits mailing list