Author: mjevans
Date: Wed Jul 13 02:52:29 2011
New Revision: 14906
Modified:
dbi/trunk/t/08keeperr.t
dbi/trunk/t/10examp.t
Log:
Change tests added for rt66127 and rt64330 to TODO tests as I don't think
they are going to be fixed soon and I'm struggling to see the wood for the
trees.
Fixed test count in 10examp.t
Removed white space at end of lines in 08keeperr.t
Modified: dbi/trunk/t/08keeperr.t
==============================================================================
--- dbi/trunk/t/08keeperr.t (original)
+++ dbi/trunk/t/08keeperr.t Wed Jul 13 02:52:29 2011
@@ -7,13 +7,13 @@
## ----------------------------------------------------------------------------
## 08keeperr.t
## ----------------------------------------------------------------------------
-#
+#
## ----------------------------------------------------------------------------
BEGIN {
use_ok('DBI');
-}
-
+}
+
$|=1;
$^W=1;
@@ -107,21 +107,21 @@
# HandleSetErr handler
$dbh->{HandleSetErr} = sub {
my ($h, $err, $errstr, $state) = @_;
- return 0
+ return 0
unless defined $err;
++$handlewarn[ $err ? 2 : length($err) ]; # count [info, warn, err] calls
- return 1
+ return 1
if $state && $state eq "return"; # for tests
($_[1], $_[2], $_[3]) = (99, "errstr99", "OV123")
if $state && $state eq "override"; # for tests
- return 0
+ return 0
if $err; # be transparent for errors
local $^W;
print "HandleSetErr called: h=$h, err=$err, errstr=$errstr,
state=$state\n";
return 0;
};
-# start our tests
+# start our tests
ok(!defined $DBI::err, '... $DBI::err is not defined');
@@ -143,9 +143,9 @@
ok(defined $DBI::err, '... $DBI::err is defined');
is($DBI::err, "0", '... $DBI::err is "0"');
-is($DBI::errstr, "(got info)\n(got warn)",
+is($DBI::errstr, "(got info)\n(got warn)",
'... $DBI::errstr is as we expected');
-is($dbh->errstr, "(got info)\n(got warn)",
+is($dbh->errstr, "(got info)\n(got warn)",
'... $dbh->errstr matches $DBI::errstr');
is($DBI::state, "AA001", '... $DBI::state is AA001');
cmp_ok($warn{warning}, '==', 1, '... $warn{warning} is 1');
@@ -160,9 +160,9 @@
is($DBI::err, "0", '... $DBI::err is "0"'); # not "", ie
it's still a warn
is($dbh->err, "0", '... $dbh->err is "0"');
is($DBI::state, "AA001", '... $DBI::state is AA001');
-is($DBI::errstr, "(got info)\n(got warn)\n(got more info)",
+is($DBI::errstr, "(got info)\n(got warn)\n(got more info)",
'... $DBI::errstr is as we expected');
-is($dbh->errstr, "(got info)\n(got warn)\n(got more info)",
+is($dbh->errstr, "(got info)\n(got warn)\n(got more info)",
'... $dbh->errstr matches $DBI::errstr');
cmp_ok($warn{warning}, '==', 2, '... $warn{warning} is 2');
is_deeply(\@handlewarn, [ 2, 1, 0 ], '... the @handlewarn array is (2, 1, 0)');
@@ -180,7 +180,7 @@
ok(defined $DBI::err, '... $DBI::err is defined');
cmp_ok($DBI::err, '==', 42, '... $DBI::err is 42');
cmp_ok($warn{warning}, '==', 2, '... $warn{warning} is 2');
-is($dbh->errstr, "(got info)\n(got warn)\n(got more info) [state was AA001 now
AA002]\n(got error)",
+is($dbh->errstr, "(got info)\n(got warn)\n(got more info) [state was AA001 now
AA002]\n(got error)",
'... $dbh->errstr is as we expected');
is($DBI::state, "AA002", '... $DBI::state is AA002');
is_deeply(\@handlewarn, [ 2, 1, 1 ], '... the @handlewarn array is (2, 1, 1)');
@@ -192,7 +192,7 @@
ok(defined $DBI::err, '... $DBI::err is defined');
cmp_ok($DBI::err, '==', 42, '... $DBI::err is 42');
cmp_ok($warn{warning}, '==', 2, '... $warn{warning} is 2');
-is($dbh->errstr, "(got info)\n(got warn)\n(got more info) [state was AA001 now
AA002]\n(got error)\n(got info)",
+is($dbh->errstr, "(got info)\n(got warn)\n(got more info) [state was AA001 now
AA002]\n(got error)\n(got info)",
'... $dbh->errstr is as we expected');
is_deeply(\@handlewarn, [ 3, 1, 1 ], '... the @handlewarn array is (3, 1, 1)');
@@ -203,7 +203,7 @@
ok(defined $DBI::err, '... $DBI::err is defined');
cmp_ok($DBI::err, '==', 42, '... $DBI::err is 42');
cmp_ok($warn{warning}, '==', 2, '... $warn{warning} is 2');
-is($dbh->errstr, "(got info)\n(got warn)\n(got more info) [state was AA001 now
AA002]\n(got error)\n(got info)\n(got warn)",
+is($dbh->errstr, "(got info)\n(got warn)\n(got more info) [state was AA001 now
AA002]\n(got error)\n(got info)\n(got warn)",
'... $dbh->errstr is as we expected');
is_deeply(\@handlewarn, [ 3, 2, 1 ], '... the @handlewarn array is (3, 2, 1)');
@@ -214,7 +214,7 @@
ok(defined $DBI::err, '... $DBI::err is defined');
cmp_ok($DBI::err, '==', 4200, '... $DBI::err is 4200');
cmp_ok($warn{warning}, '==', 2, '... $warn{warning} is 2');
-is($dbh->errstr, "(got info)\n(got warn)\n(got more info) [state was AA001 now
AA002]\n(got error)\n(got info)\n(got warn) [err was 42 now 4200] [state was
AA002 now AA003]\n(got new error)",
+is($dbh->errstr, "(got info)\n(got warn)\n(got more info) [state was AA001 now
AA002]\n(got error)\n(got info)\n(got warn) [err was 42 now 4200] [state was
AA002 now AA003]\n(got new error)",
'... $dbh->errstr is as we expected');
is_deeply(\@handlewarn, [ 3, 2, 2 ], '... the @handlewarn array is (3, 2, 2)');
@@ -241,7 +241,7 @@
ok(!defined $dbh->set_err(2, "bar"), '... $dbh->set_err returned undefiend');
# PrintError
ok(!defined $dbh->set_err(3, "baz"), '... $dbh->set_err returned undefiend');
# PrintError
ok(!defined $dbh->set_err(0, "warn"), '... $dbh->set_err returned undefiend');
# PrintError
-is($dbh->errstr, "foo [err was 1 now 2]\nbar [err was 2 now 3]\nbaz\nwarn",
+is($dbh->errstr, "foo [err was 1 now 2]\nbar [err was 2 now 3]\nbaz\nwarn",
'... $dbh->errstr is as we expected');
is($warn{failed}, 4, '... $warn{failed} is 4');
is_deeply(\@handlewarn, [ 0, 1, 3 ], '... the @handlewarn array is (0, 1,
3)');
@@ -273,7 +273,10 @@
is($dbh->state, "OV123", '... $dbh->state is as we expected');
$dbh->disconnect;
-ping_keeps_err();
+TODO: {
+ local $TODO = "rt64330 is not fixed yet";
+ ping_keeps_err();
+};
1;
# end
Modified: dbi/trunk/t/10examp.t
==============================================================================
--- dbi/trunk/t/10examp.t (original)
+++ dbi/trunk/t/10examp.t Wed Jul 13 02:52:29 2011
@@ -14,7 +14,7 @@
require File::Spec;
require VMS::Filespec if $^O eq 'VMS';
-use Test::More tests => 210;
+use Test::More tests => 212;
do {
# provide some protection against growth in size of '.' during the test
@@ -356,14 +356,16 @@
like $@, qr/\[for Statement "select mode from \?" with ParamValues: 1='val1',
2='val2', 3='val3', 4='val4', 5='val5', 6='val6', 7='val7', 8='val8', 9='val9',
10='val10', 11='val11'\]/;
# this test relies on the fact that ShowErrorStatement is set above
-eval {
- local $se_sth1->{PrintError} = 0;
- $se_sth1->execute(1,2);
-};
-unlike($@, qr/ParamValues:/, 'error string does not contain ParamValues');
-is($se_sth1->{ParamValues}, undef, 'ParamValues is empty')
+TODO: {
+ local $TODO = "rt66127 not fixed yet";
+ eval {
+ local $se_sth1->{PrintError} = 0;
+ $se_sth1->execute(1,2);
+ };
+ unlike($@, qr/ParamValues:/, 'error string does not contain ParamValues');
+ is($se_sth1->{ParamValues}, undef, 'ParamValues is empty')
or diag(Dumper($se_sth1->{ParamValues}));
-
+};
# check that $dbh->{Statement} tracks last _executed_ sth
$se_sth1 = $dbh->prepare("select mode from ?");
ok($se_sth1->{Statement} eq "select mode from ?");