[Bast-commits] r3978 - branches/DBIx-Class-Schema-Loader/current/t/lib

ilmari at dev.catalyst.perl.org ilmari at dev.catalyst.perl.org
Sun Jan 27 08:54:55 GMT 2008


Author: ilmari
Date: 2008-01-27 08:54:55 +0000 (Sun, 27 Jan 2008)
New Revision: 3978

Modified:
   branches/DBIx-Class-Schema-Loader/current/t/lib/dbixcsl_common_tests.pm
Log:
Add support for extra per-vendor tests.


Modified: branches/DBIx-Class-Schema-Loader/current/t/lib/dbixcsl_common_tests.pm
===================================================================
--- branches/DBIx-Class-Schema-Loader/current/t/lib/dbixcsl_common_tests.pm	2008-01-27 08:41:01 UTC (rev 3977)
+++ branches/DBIx-Class-Schema-Loader/current/t/lib/dbixcsl_common_tests.pm	2008-01-27 08:54:55 UTC (rev 3978)
@@ -25,6 +25,9 @@
     
     $self->{verbose} = $ENV{TEST_VERBOSE} || 0;
 
+    # Optional extra tables and tests
+    $self->{extra} ||= {};
+
     return bless $self => $class;
 }
 
@@ -43,7 +46,7 @@
 sub run_tests {
     my $self = shift;
 
-    plan tests => 108;
+    plan tests => 108 + ($self->{extra}->{count} || 0);
 
     $self->create();
 
@@ -53,7 +56,7 @@
 
     my @connect_info = ( $self->{dsn}, $self->{user}, $self->{password} );
     my %loader_opts = (
-        constraint              => qr/^(?:\S+\.)?loader_test[0-9]+$/i,
+        constraint              => qr/^(?:\S+\.)?(?:$self->{vendor}_)?loader_test[0-9]+$/i,
         relationships           => 1,
         additional_classes      => 'TestAdditional',
         additional_base_classes => 'TestAdditionalBase',
@@ -587,6 +590,8 @@
         my $obj30 = $rsobj30->find(123);
         isa_ok( $obj30->loader_test2, $class2);
     }
+
+    $self->{extra}->{run}->($conn, $monikers, $classes) if $self->{extra}->{run};
 }
 
 sub dbconnect {
@@ -1006,6 +1011,8 @@
             $dbh->do($_) for (@statements_implicit_rels);
         }
     }
+
+    $dbh->do($_) for @{ $self->{extra}->{create} || [] };
     $dbh->disconnect();
 }
 
@@ -1070,6 +1077,8 @@
 
     my $dbh = $self->dbconnect(0);
 
+    $dbh->do("DROP TABLE $_") for @{ $self->{extra}->{drop} || [] };
+
     unless($self->{skip_rels}) {
         $dbh->do("DROP TABLE $_") for (@tables_reltests);
         unless($self->{vendor} =~ /sqlite/i) {




More information about the Bast-commits mailing list