1
0
Fork 0
mirror of https://github.com/DBD-SQLite/DBD-SQLite synced 2025-06-07 14:19:10 -04:00

Removing the table name generator, since each test now uses it's own database

This commit is contained in:
Adam Kennedy 2009-04-16 00:54:21 +00:00
parent dfd5fc6f14
commit e93d416d28
14 changed files with 20 additions and 57 deletions

View file

@ -9,7 +9,7 @@ BEGIN {
}
use t::lib::Test;
use Test::More tests => 9;
use Test::More tests => 10;
use Test::NoWarnings;
# Ordinary connect
@ -32,3 +32,9 @@ SKIP: {
isa_ok( $dbh, 'DBI::db' );
is( $dbh->{unicode}, 1, 'Unicode is on' );
}
# Connect to a memory database
SCOPE: {
my $dbh = DBI->connect( 'dbi:SQLite:dbname=:memory:', '', '' );
isa_ok( $dbh, 'DBI::db' );
}

View file

@ -6,8 +6,9 @@ BEGIN {
$^W = 1;
}
use Test::More tests => 15;
use t::lib::Test;
use Test::More tests => 15;
use Test::NoWarnings;
# Create the aggregate test packages
SCOPE: {

View file

@ -34,7 +34,7 @@ while (Testing()) {
#
# Find a possible new table name
#
Test($state or $test_table = FindNewTable($dbh)) or 1
Test($state or $test_table = 'table1') or 1
or ErrMsg("Cannot get table name: $dbh->errstr.\n");
#

View file

@ -45,7 +45,7 @@ while (Testing()) {
# Find a possible new table name
#
my $table;
Test($state or $table = FindNewTable($dbh))
Test($state or $table = 'table1')
or DbiError($dbh->err, $dbh->errstr);
#

View file

@ -47,7 +47,7 @@ while (Testing()) {
#
# Find a possible new table name
#
Test($state or $table = FindNewTable($dbh), 'FindNewTable')
Test($state or $table = 'table1')
or DbiError($dbh->err, $dbh->errstr);
#

View file

@ -60,7 +60,7 @@ while (Testing()) {
#
# Find a possible new table name
#
Test($state or $table = FindNewTable($dbh), 'FindNewTable')
Test($state or $table = 'table1')
or DbiError($dbh->err, $dbh->errstr);
#

View file

@ -76,7 +76,7 @@ while (Testing()) {
#
# Find a possible new table name
#
Test($state or $table = FindNewTable($dbh))
Test($state or $table = 'table1')
or DbiError($dbh->error, $dbh->errstr);
my($def);

View file

@ -54,7 +54,7 @@ while (Testing()) {
#
# Find a possible new table name
#
Test($state or $table = FindNewTable($dbh))
Test($state or $table = 'table1')
or DbiError($dbh->err, $dbh->errstr);
#

View file

@ -48,7 +48,7 @@ while (Testing()) {
#
# Find a possible new table name
#
Test($state or $table = FindNewTable($dbh))
Test($state or $table = 'table1')
or DbiError($dbh->err, $dbh->errstr);
#

View file

@ -57,7 +57,7 @@ while (Testing()) {
#
# Find a possible new table name
#
Test($state or ($table = FindNewTable($dbh)))
Test($state or ($table = 'table1'))
or DbiError($dbh->err, $dbh->errstr);
#

View file

@ -52,7 +52,7 @@ while (Testing()) {
# Find a possible new table name
#
my $table = '';
Test($state or $table = FindNewTable($dbh))
Test($state or $table = 'table1')
or ErrMsgF("Cannot determine a legal table name: Error %s.\n",
$dbh->errstr);

View file

@ -71,7 +71,7 @@ while (Testing()) {
#
# Find a possible new table name
#
Test($state or $table = FindNewTable($dbh))
Test($state or $table = 'table1')
or ErrMsgF("Cannot determine a legal table name: Error %s.\n",
$dbh->errstr);

View file

@ -215,51 +215,7 @@ sub DbiError ($$) {
print "Test $::numTests: DBI error $rc, $err\n";
}
#
# This functions generates a list of possible DSN's aka
# databases and returns a possible table name for a new
# table being created.
SCOPE: {
my(@tables, $testtable, $listed);
$testtable = "testaa";
$listed = 0;
sub FindNewTable($) {
my($dbh) = @_;
if (!$listed) {
@tables = $dbh->func('list_tables');
if ($dbh->errstr) {
die "Cannot create table list: " . $dbh->errstr;
}
$listed = 1;
}
# A small loop to find a free test table we can use to mangle stuff in
# and out of. This starts at testaa and loops until testaz, then testba
# - testbz and so on until testzz.
my $foundtesttable = 1;
my $table;
while ($foundtesttable) {
$foundtesttable = 0;
foreach $table (@tables) {
if ($table eq $testtable) {
$testtable++;
$foundtesttable = 1;
}
}
}
$table = $testtable;
$testtable++;
$table;
}
}
sub ErrMsg { print (@_); }
sub ErrMsgF { printf (@_); }
1;

View file

@ -60,7 +60,7 @@ while (Testing()) {
#
# Find a possible new table name
#
Test($state or ($table = FindNewTable($dbh)))
Test($state or $table = 'table1')
or DbiError($dbh->err, $dbh->errstr);
#