Re: Tests needed for bugs 64330 and 66127
"Martin J. Evans" <[email protected]>
| Newsgroups | gmane.comp.lang.perl.modules.dbi.sybase.devel |
|---|---|
| Message-ID | <[email protected]> |
On 11/03/2011 16:53, Tim Bunce wrote: > Time's in very short supply at the moment, but if someone can contribute > tests for these (ideally as patches to existing test scripts) then I'll > fix'em as soon as I get a moment. > > Both are simple: > https://rt.cpan.org/Public/Bug/Display.html?id=66127 > https://rt.cpan.org/Public/Bug/Display.html?id=64330 > > Tim. Attached a patch for ping issue. However: o wasn't sure where to put it 08keeperr.t seemed to have some logic o it raised another issue - ping on DBD::Sponge does not return true and DBD::Sponge does not have ping. I left the test in for that so it produces 2 errors not 1. Of course by the time it is re-run with those z* tests the errors mount up. I'll commit it if you want but because of above I haven't. If you give me a hint where the best place for the other bug is I'll try and do that too. Martin
patch
(text/plain, 1.1 KB)
Index: t/08keeperr.t
===================================================================
--- t/08keeperr.t (revision 14749)
+++ t/08keeperr.t (working copy)
@@ -2,7 +2,7 @@
use strict;
-use Test::More tests => 69;
+use Test::More tests => 72;
## ----------------------------------------------------------------------------
## 08keeperr.t
@@ -69,6 +69,17 @@
package main;
+# test ping does not destroy the errstr
+sub ping_keeps_err {
+ my $dbh = DBI->connect('DBI:Sponge:');
+ $dbh->{PrintError} = 0;
+ eval {$dbh->do(q/invalid sql statement/)};
+ ok(defined($dbh->errstr), "Error from invalid SQL");
+ ok($dbh->ping, "ping returns true"); # for me this returns false!
+ ok(defined($dbh->errstr), "Error exists after ping");
+ $dbh->disconnect;
+}
+
## ----------------------------------------------------------------------------
print "Test HandleSetErr\n";
@@ -260,8 +271,9 @@
cmp_ok($dbh->err, '==', 99, '... $dbh->err is 99');
is($dbh->errstr, "errstr99", '... $dbh->errstr is as we expected');
is($dbh->state, "OV123", '... $dbh->state is as we expected');
-
$dbh->disconnect;
+ping_keeps_err();
+
1;
# end