diff DBD/t/11prep.t @ 26:a0b0ed79f8ab

Move tests for Bugs 2885, 2889, 2897 and 3235 from main repo to here
author Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
date Tue, 15 Dec 2020 15:05:24 +0100 (2020-12-15)
parents 8c8bd15f7a0b
children
line wrap: on
line diff
--- a/DBD/t/11prep.t
+++ b/DBD/t/11prep.t
@@ -10,13 +10,14 @@
 
 use strict;
 use warnings;
+use Data::Dumper;
 use DBI();
 use DBD_TEST();
 
 use Test::More;
 
 if (defined $ENV{DBI_DSN}) {
-  plan tests => 15;
+  plan tests => 19;
 } else {
   plan skip_all => 'Cannot test without DB info';
 }
@@ -42,7 +43,7 @@ pass('Database connection created');
   local $dbh->{PrintError} = 0;
   local $dbh->{RaiseError} = 1;
   ok( !eval{ $dbh->do("DROP TABLE $tbl") },"DROP TABLE $tbl");
-  print $@, "\n";
+  ok( $@ =~ /no such table/, "DROP TABLE failed for the right reason");
 }
 ok( $dbh->do("CREATE TABLE $tbl( chr char( 1 ) )"),"CREATE TABLE $tbl");
 
@@ -59,4 +60,13 @@ ok( !( $sth = undef ),'Set sth to undefi
 #ok( !( $sth = undef ),'Set sth to undefined');
 ok( $dbh->do("DROP TABLE $tbl"),"DROP TABLE $tbl");
 
+# Bug 3235
+ok( $sth = $dbh->prepare("SELECT 0"), "SELECT 0");
+ok( $sth->execute, 'Execute');
+my $res = $sth->fetchall_arrayref;
+$Data::Dumper::Terse = 1;        # don't output names where feasible
+my $dumped = Dumper($res);
+$dumped =~ s/\s+/ /gm;
+ok( $res->[0]->[0] == 0, "yields $dumped");
+
 ok( $dbh->disconnect,'Disconnect');