[svn:dbd-oracle] r15552 - in dbd-oracle/trunk: . t

[email protected] Mon, 7 Jan 2013 10:11:30 -0800 (PST)
Newsgroups perl.dbd.oracle.changes
Message-ID <[email protected]>
Author: yanick
Date: Mon Jan  7 10:11:29 2013
New Revision: 15552

Modified:
   dbd-oracle/trunk/Changes
   dbd-oracle/trunk/t/26exe_array.t

Log:
done_testing() removed from END block (RT82506)

... as that was too little, too late.

Modified: dbd-oracle/trunk/Changes
==============================================================================
--- dbd-oracle/trunk/Changes	(original)
+++ dbd-oracle/trunk/Changes	Mon Jan  7 10:11:29 2013
@@ -1,5 +1,9 @@
 Revision history for DBD::Oracle
 
+{{$NEXT}}
+  - fix t/26exe_array.t in the case of no db connection (RT82506, 
+    reported by Peter Rabbitson)
+
 1.54      2013-01-03
  - promote 1.53_00 to official release
 

Modified: dbd-oracle/trunk/t/26exe_array.t
==============================================================================
--- dbd-oracle/trunk/t/26exe_array.t	(original)
+++ dbd-oracle/trunk/t/26exe_array.t	Mon Jan  7 10:11:29 2013
@@ -13,43 +13,27 @@
 
 $| = 1;
 
-my $has_test_nowarnings = 1;
-eval "require Test::NoWarnings";
-$has_test_nowarnings = undef if $@;
-
-my ($dbh, $ea);
+my $has_test_nowarnings = eval "require Test::NoWarnings; 1";
 
 use DBI qw(:sql_types);
 use ExecuteArray;
 
-END {
-    if ($dbh && $ea) {
-        $ea->drop_table($dbh);
-        $dbh->disconnect();
-    }
-    Test::NoWarnings::had_no_warnings()
-          if ($has_test_nowarnings);
-    done_testing();
-}
 
 my $dsn = oracle_test_dsn();
 my $dbuser = $ENV{ORACLE_USERID} || 'scott/tiger';
 $ENV{NLS_NCHAR} = "US7ASCII";
 $ENV{NLS_LANG} = "AMERICAN";
 
-eval {
-    $dbh = DBI->connect($dsn, $dbuser, '', {PrintError => 0});
-};
+my $dbh = eval {
+    DBI->connect($dsn, $dbuser, '', {PrintError => 0})
+} or plan skip_all => "Unable to connect to Oracle";
 
-if (!$dbh) {
-    plan skip_all => "Unable to connect to Oracle";
-}
-
-$ea = ExecuteArray->new($dbh, 1); # set odbc_disable_array_operations
+my $ea = ExecuteArray->new($dbh, 1); # set odbc_disable_array_operations
 $dbh = $ea->dbh;
 
 $ea->drop_table($dbh);
 ok($ea->create_table($dbh), "create test table") or exit 1;
+
 $ea->simple($dbh, {array_context => 1, raise => 1});
 $ea->simple($dbh, {array_context => 0, raise => 1});
 $ea->error($dbh, {array_context => 1, raise => 1});
@@ -61,7 +45,21 @@
 
 $ea->update($dbh, {array_context => 1, raise => 1});
 
-$ea->error($dbh, {array_context => 1, raise => 1, notuplestatus => 1});
-$ea->error($dbh, {array_context => 0, raise => 1, notuplestatus => 1});
-$ea->error($dbh, {array_context => 1, raise => 0, notuplestatus => 1});
-$ea->error($dbh, {array_context => 0, raise => 0, notuplestatus => 1});
+for my $raise ( 0..1 ) {
+    for my $context ( 0..1 ) {
+        $ea->error($dbh, {
+            array_context => $context, 
+            raise => $raise, 
+            notuplestatus => 1
+        });
+    }
+}
+
+if ($dbh && $ea) {
+    $ea->drop_table($dbh);
+    $dbh->disconnect();
+}
+
+Test::NoWarnings::had_no_warnings() if $has_test_nowarnings;
+
+done_testing;