Author: mjevans
Date: Thu Aug 12 03:15:40 2010
New Revision: 14323
Modified:
dbi/trunk/Changes
dbi/trunk/t/50dbm_simple.t
Log:
Removed all that complicated test counting from 50dbm_simple and fixed
problems not reporting prepare/execute errors.
Modified: dbi/trunk/Changes
==============================================================================
--- dbi/trunk/Changes (original)
+++ dbi/trunk/Changes Thu Aug 12 03:15:40 2010
@@ -22,6 +22,9 @@
$h->{InactiveDestroy} (David E. Wheeler)
Added ability for parallel testing "prove -j4 ..." (Jens Rehsack)
Added tests for delete in DBM (H.Merijn Brand)
+ Changed 50dbm_simple to delete all test counting code as it is getting
+ far too complicated and switched to done_testing. Fixed problems
+ skipping errors on prepare and execute. (Martin J. Evans)
=head2 Changes in DBI 1.613 (svn r14271) 22nd July 2010
Modified: dbi/trunk/t/50dbm_simple.t
==============================================================================
--- dbi/trunk/t/50dbm_simple.t (original)
+++ dbi/trunk/t/50dbm_simple.t Thu Aug 12 03:15:40 2010
@@ -144,26 +144,9 @@
@{ $expected_results{$columns} } = @{$tests[1]};
}
-my $tests_offsets_group = 5;
-my $ndbm_types = scalar @dbm_types;
-my $nmldbm_types = scalar @mldbm_types;
-my $tests_without_mldbm = $tests_offsets_group +
scalar(@{$test_statements{2}});
- $tests_without_mldbm += grep { m/^(?:SELECT|UPDATE|DELETE)/ } @{
$test_statements{2} };
-my $tests_per_mldbm = $tests_offsets_group + scalar(@{$test_statements{3}});
- $tests_per_mldbm += grep { m/^(?:SELECT|UPDATE|DELETE)/ } @{
$test_statements{3} };
-my $tests_with_mldbm = $tests_per_mldbm * ($nmldbm_types - 1);
-my $num_tests = $ndbm_types * ( $tests_without_mldbm + $tests_with_mldbm );
-printf "Test count: %d x ( ( %d + %d ) + %d x ( %d + %d ) ) = %d\n",
- $ndbm_types, $tests_offsets_group, $tests_without_mldbm -
$tests_offsets_group,
- $nmldbm_types - 1, $tests_offsets_group, $tests_per_mldbm -
$tests_offsets_group,
- $num_tests;
-
-if (!$num_tests) {
+unless (@dbm_types) {
plan skip_all => "No DBM modules available";
}
-else {
- plan tests => $num_tests;
-}
for my $mldbm ( @mldbm_types ) {
my $columns = ($mldbm) ? 3 : 2;
@@ -174,11 +157,11 @@
}
}
+done_testing();
+
sub do_test {
my ($dtype, $mldbm, $columns) = @_;
- my $test_builder = Test::More->builder;
- my $starting_test_no = $test_builder->current_test;
#diag ("Starting test: " . $starting_test_no);
# The DBI can't test locking here, sadly, because of the risk it'll hang
@@ -244,10 +227,8 @@
my $comment = $1;
my $sth = $dbh->prepare($sql);
- unless( $sth ) {
- skip "prepare failed: " . $dbh->errstr || 'unknown error',
- ($sql =~ /SELECT/) ? 2 : 1;
- }
+ ok($sth, "prepare $sql") or diag($dbh->errstr || 'unknown error');
+
my @bind;
if($sth->{NUM_OF_PARAMS})
{
@@ -256,10 +237,9 @@
# if execute errors we will handle it, not PrintError:
$sth->{PrintError} = 0;
my $n = $sth->execute(@bind);
- if ($sth->errstr and $sql !~ /^DROP/ ) {
- skip "execute failed: " . $sth->errstr || 'unknown error',
- ($sql =~ /^(?:SELECT|UPDATE|DELETE)/) ? 2 : 1;
- }
+ ok($n, 'execute') or diag($sth->errstr || 'unknown error');
+ next if (!defined($n));
+
is( $n, $results[$idx], $sql ) unless( 'ARRAY' eq ref $results[$idx] );
TODO: {
local $TODO = "AUTOPROXY drivers might throw away sth->rows()"
if($ENV{DBI_AUTOPROXY});