[Bast-commits] r7532 - DBIx-Class/0.08/branches/pg_unqualified_schema/t

rbuels at dev.catalyst.perl.org rbuels at dev.catalyst.perl.org
Thu Sep 3 22:28:39 GMT 2009


Author: rbuels
Date: 2009-09-03 22:28:39 +0000 (Thu, 03 Sep 2009)
New Revision: 7532

Modified:
   DBIx-Class/0.08/branches/pg_unqualified_schema/t/72pg.t
Log:
more work on pg tests

Modified: DBIx-Class/0.08/branches/pg_unqualified_schema/t/72pg.t
===================================================================
--- DBIx-Class/0.08/branches/pg_unqualified_schema/t/72pg.t	2009-09-03 22:28:31 UTC (rev 7531)
+++ DBIx-Class/0.08/branches/pg_unqualified_schema/t/72pg.t	2009-09-03 22:28:39 UTC (rev 7532)
@@ -61,7 +61,7 @@
 # run a BIG bunch of tests for last-insert-id / Auto-PK / sequence
 # discovery
 run_apk_tests($schema); #< older set of auto-pk tests
-#run_extended_apk_tests($schema); #< new extended set of auto-pk tests
+run_extended_apk_tests($schema); #< new extended set of auto-pk tests
 
 ### type_info tests
 
@@ -455,11 +455,8 @@
         $new = $schema->resultset('Artist')->create({ name => 'bar' });
         is($new->artistid, 5, "Auto-PK worked");
     } 'old auto-pk tests did not die either';
-
-
 }
 
-
 # sets the artist table name and clears sequence name cache
 sub apk_t_set {
     my ( $s, $n ) = @_;
@@ -493,22 +490,23 @@
 BEGIN{ @apk_schemas = map "dbic_apk_$_", 0..5 }
 
 sub run_extended_apk_tests {
-    my $schema = shift;
+  my $schema = shift;
 
-    eapk_drop_all($schema,'no warn');
+  eapk_drop_all($schema,'no warn');
 
-    # make the test schemas
-    $schema->storage->dbh_do("CREATE SCHEMA $_")
+  # make the test schemas
+  $schema->storage->dbh_do(sub {
+    $_[1]->do("CREATE SCHEMA $_")
         for @apk_schemas;
+  });
 
-    eapk_create($schema, with_search_path => [0,1]);
+  eapk_create($schema, with_search_path => [0,1]);
 
-    #unqualified table, unqualified 
-    lives_ok {
-        $schema->resultset('ExtAPK')->create({});
-    } 'create in first schema does not die';
+  #unqualified table, unqualified 
+  lives_ok {
+    $schema->resultset('ExtAPK')->create({});
+  } 'create in first schema does not die';
 
-    #drop_ext_apk_test_schema($schema);
 }
 
 sub eapk_create {
@@ -526,7 +524,6 @@
             $dbh->do("SET search_path = $search_path");
         }
 
-
         my $schema = $a{qualify} ? "$a{qualify}." : '';
         $dbh->do(<<EOS);
 CREATE TABLE apk_t (
@@ -544,7 +541,6 @@
 }
 
 
-
 sub eapk_drop_all {
     my ( $schema, $no_warn ) = @_;
 
@@ -552,11 +548,13 @@
         my (undef,$dbh) = @_;
 
         local $dbh->{Warn} = 0;
-        local $SIG{__DIE__} = $no_warn ? sub{} : \&diag;
 
         # drop the test schemas
-        $dbh->do("DROP SCHEMA $_ CASCADE")
-            for @apk_schemas;
+        for (@apk_schemas ) {
+            eval{ $dbh->do("DROP SCHEMA $_ CASCADE") };
+            diag $@ if $@ && !$no_warn;
+        }
 
+
     });
 }




More information about the Bast-commits mailing list