"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "t/08keeperr.t" between
DBI-1.642.tar.gz and DBI-1.643.tar.gz

About: DBI - The Perl Database Interface (requires one or more "driver" modules DBD::* to talk to databases).

08keeperr.t  (DBI-1.642):08keeperr.t  (DBI-1.643)
skipping to change at line 128 skipping to change at line 128
} }
## ---------------------------------------------------------------------------- ## ----------------------------------------------------------------------------
print "Test HandleSetErr\n"; print "Test HandleSetErr\n";
my $dbh = DBI->connect(@con_info); my $dbh = DBI->connect(@con_info);
isa_ok($dbh, "DBI::db"); isa_ok($dbh, "DBI::db");
$dbh->{RaiseError} = 1; $dbh->{RaiseError} = 1;
$dbh->{PrintError} = 1; $dbh->{PrintError} = 1;
$dbh->{RaiseWarn} = 0;
$dbh->{PrintWarn} = 1; $dbh->{PrintWarn} = 1;
# warning handler # warning handler
my %warn; my %warn;
my @handlewarn; my @handlewarn;
sub reset_warn_counts { sub reset_warn_counts {
%warn = ( failed => 0, warning => 0 ); %warn = ( failed => 0, warning => 0 );
@handlewarn = (0,0,0); @handlewarn = (0,0,0);
} }
skipping to change at line 217 skipping to change at line 218
'... $DBI::errstr is as we expected'); '... $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'); '... $dbh->errstr matches $DBI::errstr');
cmp_ok($warn{warning}, '==', 2, '... $warn{warning} is 2'); cmp_ok($warn{warning}, '==', 2, '... $warn{warning} is 2');
is_deeply(\@handlewarn, [ 2, 1, 0 ], '... the @handlewarn array is (2, 1, 0)'); is_deeply(\@handlewarn, [ 2, 1, 0 ], '... the @handlewarn array is (2, 1, 0)');
# ---- # ----
$dbh->{RaiseError} = 0; $dbh->{RaiseError} = 0;
$dbh->{PrintError} = 1; $dbh->{PrintError} = 1;
$dbh->{RaiseWarn} = 1;
# ---- # ----
$dbh->set_err("42", "(got error)", "AA002"); $dbh->set_err("42", "(got error)", "AA002");
ok(defined $DBI::err, '... $DBI::err is defined'); ok(defined $DBI::err, '... $DBI::err is defined');
cmp_ok($DBI::err, '==', 42, '... $DBI::err is 42'); cmp_ok($DBI::err, '==', 42, '... $DBI::err is 42');
cmp_ok($warn{warning}, '==', 2, '... $warn{warning} is 2'); 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 A A002]\n(got error)", is($dbh->errstr, "(got info)\n(got warn)\n(got more info) [state was AA001 now A A002]\n(got error)",
'... $dbh->errstr is as we expected'); '... $dbh->errstr is as we expected');
skipping to change at line 334 skipping to change at line 336
SKIP: { SKIP: {
# we could test this with gofer is we used a different keep_err method other than STORE # we could test this with gofer is we used a different keep_err method other than STORE
# to trigger the set_err calls # to trigger the set_err calls
skip 'set_err keep_error skipped for Gofer', 2 skip 'set_err keep_error skipped for Gofer', 2
if $using_dbd_gofer; if $using_dbd_gofer;
$dbh->{examplep_set_err} = ""; # set information state $dbh->{examplep_set_err} = ""; # set information state
cmp_ok($warn{warning}, '==', 0, 'no extra warning generated for set_err ("") in STORE'); cmp_ok($warn{warning}, '==', 0, 'no extra warning generated for set_err ("") in STORE');
$dbh->{RaiseWarn} = 0;
$dbh->{examplep_set_err} = "0"; # set warning state $dbh->{examplep_set_err} = "0"; # set warning state
cmp_ok($warn{warning}, '==', 1, 'warning generated for set_err("0") in STORE'); cmp_ok($warn{warning}, '==', 1, 'warning generated for set_err("0") in STORE');
} }
# --- # ---
# ---- # ----
done_testing(); done_testing();
1; 1;
 End of changes. 3 change blocks. 
0 lines changed or deleted 4 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)