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

use done_testing and remove plan tests

This commit is contained in:
Kenichi Ishigaki 2019-01-06 09:03:41 +09:00
parent fc55eeb0d7
commit c84a0a9781
111 changed files with 276 additions and 207 deletions

View file

@ -3,7 +3,7 @@
use strict;
use warnings;
use Test::More tests => 3;
use Test::More;
use lib "t/lib";
@ -17,3 +17,5 @@ if (my @compile_options = DBD::SQLite::compile_options()) {
diag("Compile Options:");
diag(join "", map { " $_\n" } @compile_options);
}
done_testing;

View file

@ -7,8 +7,6 @@ use SQLiteTest qw/connect_ok @CALL_FUNCS/;
use Test::More;
use Test::NoWarnings;
plan tests => 20 * @CALL_FUNCS + 1;
my $show_diag = 0;
foreach my $call_func (@CALL_FUNCS) {
@ -59,3 +57,5 @@ foreach my $call_func (@CALL_FUNCS) {
isa_ok( $dbh, 'DBI::db' );
}
}
done_testing;

View file

@ -4,7 +4,7 @@ use strict;
use warnings;
use lib "t/lib";
use SQLiteTest;
use Test::More tests => 7;
use Test::More;
use Test::NoWarnings;
my $dbh = connect_ok();
@ -28,3 +28,5 @@ ok( $sth->execute, '->execute ok' );
my $names = $sth->{NAME};
is( scalar(@$names), 4, 'Got 4 columns' );
is_deeply( $names, [ 'f1', 'f1', 'f2', 'f3' ], 'Table prepending is disabled by default' );
done_testing;

View file

@ -2,7 +2,7 @@ use strict;
use warnings;
use lib "t/lib";
use SQLiteTest;
use Test::More tests => 14;
use Test::More;
use Test::NoWarnings;
my $dbh = connect_ok();
@ -34,3 +34,5 @@ SCOPE: {
}
is( $dbh->do("delete from f where f1='test'"), 3 );
done_testing;

View file

@ -2,7 +2,7 @@ use strict;
use warnings;
use lib "t/lib";
use SQLiteTest;
use Test::More tests => 22;
use Test::More;
use Test::NoWarnings;
my $dbh = connect_ok( RaiseError => 1 );
@ -55,3 +55,5 @@ while ($row = $sth->fetch) {
ok($num_rows == 1);
$sth->finish;
$dbh->do("delete from f where f1='test'");
done_testing;

View file

@ -2,7 +2,7 @@ use strict;
use warnings;
use lib "t/lib";
use SQLiteTest;
use Test::More tests => 6;
use Test::More;
use Test::NoWarnings;
my $dbh = connect_ok(
@ -48,3 +48,5 @@ $dbh->rollback;
);
ok !$dbh->{sqlite_use_immediate_transaction}, "sqlite_use_immediate_transaction is false if you set explicitly";
}
done_testing;

View file

@ -2,7 +2,7 @@ use strict;
use warnings;
use lib "t/lib";
use SQLiteTest;
use Test::More tests => 8;
use Test::More;
use Test::NoWarnings;
my $dbh = connect_ok( RaiseError => 1, PrintError => 0 );
@ -24,3 +24,5 @@ eval {
ok($@, 'Statement 2 generated an error');
is( $DBI::err, 19, '$DBI::err ok' );
like( $DBI::errstr, qr/column a is not unique|UNIQUE constraint failed/, '$DBI::errstr ok' );
done_testing;

View file

@ -7,8 +7,6 @@ use SQLiteTest qw/connect_ok dbfile @CALL_FUNCS/;
use Test::More;
use Test::NoWarnings;
plan tests => 11 * @CALL_FUNCS + 1;
foreach my $call_func (@CALL_FUNCS) {
my $dbh = connect_ok(
@ -119,3 +117,5 @@ foreach my $call_func (@CALL_FUNCS) {
unlink $dbfile;
}
}
done_testing;

View file

@ -13,8 +13,6 @@ if ($DBD::SQLite::sqlite_version_number >= 3008003) {
push @function_flags, DBD::SQLite::Constants::SQLITE_DETERMINISTIC;
}
plan tests => 29 * @CALL_FUNCS * @function_flags + 1;
sub now {
return time();
}
@ -130,3 +128,5 @@ foreach my $call_func (@CALL_FUNCS) { for my $flags (@function_flags) {
$dbh->disconnect;
}}
done_testing;

View file

@ -12,8 +12,6 @@ if ($DBD::SQLite::sqlite_version_number >= 3008003) {
push @function_flags, DBD::SQLite::Constants::SQLITE_DETERMINISTIC;
}
plan tests => 21 * @CALL_FUNCS * @function_flags + 1;
# Create the aggregate test packages
SCOPE: {
package count_aggr;
@ -134,3 +132,5 @@ foreach my $call_func (@CALL_FUNCS) { for my $flags (@function_flags) {
$dbh->disconnect;
}}
done_testing;

View file

@ -35,8 +35,6 @@ my %info = (
SQL_TABLE_TERM => 'table',
);
plan tests => scalar(keys %info) + 2;
my $dbh = connect_ok( RaiseError => 1 );
foreach my $option ( sort keys %info ) {
@ -47,3 +45,5 @@ foreach my $option ( sort keys %info ) {
}
$dbh->disconnect;
done_testing;

View file

@ -7,9 +7,7 @@ use lib "t/lib";
use SQLiteTest;
use Test::More;
BEGIN {
if ( $] >= 5.008005 ) {
plan( tests => 26 );
} else {
unless ( $] >= 5.008005 ) {
plan( skip_all => 'Unicode is not supported before 5.8.5' );
}
}
@ -131,3 +129,5 @@ sub database_roundtrip {
croak "Bad row length ".@row unless (@row == 2);
@row;
}
done_testing;

View file

@ -4,13 +4,7 @@ use lib "t/lib";
use SQLiteTest qw/connect_ok dies @CALL_FUNCS/;
use Test::More;
BEGIN {
my $COLLATION_TESTS = 10;
my $WRITE_ONCE_TESTS = 4;
if ( $] >= 5.008005 ) {
plan( tests => $COLLATION_TESTS * @CALL_FUNCS +
$WRITE_ONCE_TESTS + 1);
} else {
unless ( $] >= 5.008005 ) {
plan( skip_all => 'Unicode is not supported before 5.8.5' );
}
}
@ -128,3 +122,5 @@ foreach my $call_func (@CALL_FUNCS) {
"collate by_length (@sorted // @$db_sorted)");
}
}
done_testing;

View file

@ -5,8 +5,6 @@ use SQLiteTest qw/connect_ok @CALL_FUNCS/;
use Test::More;
use Test::NoWarnings;
plan tests => 5 * @CALL_FUNCS + 1;
my $N_OPCODES = 50; # how many opcodes before calling the progress handler
# our progress_handler just remembers how many times it was called
@ -48,3 +46,5 @@ foreach my $call_func (@CALL_FUNCS) {
$dbh->disconnect;
}
done_testing;

View file

@ -2,7 +2,7 @@ use strict;
use warnings;
use lib "t/lib";
use SQLiteTest;
use Test::More tests => 37;
use Test::More;
use Test::NoWarnings;
# Create a database
@ -130,3 +130,5 @@ SCOPE: {
my $sth = $dbh->prepare("UPDATE one SET id = 3 WHERE name = 'Gary Shea'");
isa_ok( $sth, 'DBI::st' );
}
done_testing;

View file

@ -2,7 +2,7 @@ use strict;
use warnings;
use lib "t/lib";
use SQLiteTest;
use Test::More tests => 12;
use Test::More;
use Test::NoWarnings;
my $dbh = DBI->connect('dbi:SQLite:dbname=:memory:',undef,undef,{RaiseError => 1});
@ -75,3 +75,5 @@ SKIP: {
# 11. Correct info retrieved
is_deeply( \@info, $expected, 'We got the right info from multiple databases' );
}
done_testing;

View file

@ -5,7 +5,7 @@ use strict;
use warnings;
use lib "t/lib";
use SQLiteTest;
use Test::More tests => 4;
use Test::More;
use Test::NoWarnings;
# Create a database
@ -21,3 +21,5 @@ END_SQL
# Drop the table
ok( $dbh->do('DROP TABLE one'), 'DROP TABLE' );
done_testing;

View file

@ -4,7 +4,7 @@ use strict;
use warnings;
use lib "t/lib";
use SQLiteTest;
use Test::More tests => 10;
use Test::More;
use Test::NoWarnings;
# Create a database
@ -41,3 +41,5 @@ SCOPE: {
my $row2 = $sth->fetchrow_arrayref;
is( $row2, undef, 'fetch empty statement handler' );
}
done_testing;

View file

@ -2,7 +2,7 @@ use strict;
use warnings;
use lib "t/lib";
use SQLiteTest;
use Test::More tests => 39;
use Test::More;
use Test::NoWarnings;
use DBI ':sql_types';
@ -81,3 +81,5 @@ SCOPE: {
is( $id, 6, 'id = 6' );
is( $name, 'Larry', 'name = Larry' );
}
done_testing;

View file

@ -5,7 +5,7 @@ use strict;
use warnings;
use lib "t/lib";
use SQLiteTest;
use Test::More tests => 17;
use Test::More;
use Test::NoWarnings;
use DBI ':sql_types';
@ -81,3 +81,5 @@ SCOPE: {
], 'Got the blob back ok' );
ok( $sth->finish, '->finish' );
}
done_testing;

View file

@ -2,7 +2,7 @@ use strict;
use warnings;
use lib "t/lib";
use SQLiteTest;
use Test::More tests => 27;
use Test::More;
use Test::NoWarnings;
my $dbh = connect_ok(
@ -74,3 +74,5 @@ sub dumpblob {
}
if ($ENV{SHOW_BLOBS}) { close(OUT) }
}
done_testing;

View file

@ -4,7 +4,7 @@ use strict;
use warnings;
use lib "t/lib";
use SQLiteTest;
use Test::More tests => 12;
use Test::More;
use Test::NoWarnings;
# Create a database
@ -40,3 +40,5 @@ SCOPE: {
is( $sth->{NUM_OF_FIELDS}, 0, 'No fields in statement' );
ok( $sth->finish, '->finish ok' );
}
done_testing;

View file

@ -4,7 +4,7 @@ use strict;
use warnings;
use lib "t/lib";
use SQLiteTest;
use Test::More tests => 9;
use Test::More;
# Create a database
my $dbh = connect_ok();
@ -34,3 +34,5 @@ SCOPE: {
is( $row->[1], 'NULL-valued id', 'Second column is defined' );
ok( $sth->finish, '->finish' );
}
done_testing;

View file

@ -4,7 +4,7 @@ use strict;
use warnings;
use lib "t/lib";
use SQLiteTest;
use Test::More tests => 18;
use Test::More;
use Test::NoWarnings;
sub rows {
@ -72,3 +72,5 @@ SCOPE: {
rows( $sth, 2 );
ok( $sth->finish, '->finish' );
}
done_testing;

View file

@ -4,7 +4,7 @@ use strict;
use warnings;
use lib "t/lib";
use SQLiteTest;
use Test::More tests => 14;
use Test::More;
use Test::NoWarnings;
# Create a database
@ -61,3 +61,5 @@ SCOPE: {
], 'ChopBlanks = 1' );
ok( $sth->finish, '->finish' );
}
done_testing;

View file

@ -4,7 +4,7 @@ use strict;
use warnings;
use lib "t/lib";
use SQLiteTest;
use Test::More tests => 28;
use Test::More;
# use Test::NoWarnings;
my $warning_count = 0;
@ -107,3 +107,5 @@ SCOPE: {
$SIG{__WARN__} = 'DEFAULT';
is( $warning_count, 2, 'Got one warning' );
}
done_testing;

View file

@ -1,6 +1,6 @@
use strict;
use warnings;
use Test::More tests => 21;
use Test::More;
use lib "t/lib";
use SQLiteTest;
@ -51,3 +51,5 @@ isnt $types->[0], 'VARCHAR(2)', '$sth->{TYPE}[0] doesn\'t return a string';
isnt $types->[1], 'CHAR(1)', '$sth->{TYPE}[1] doesn\'t return a string';
like $types->[0], qr/^-?\d+$/, '$sth->{TYPE}[0] returns an integer';
like $types->[1], qr/^-?\d+$/, '$sth->{TYPE}[1] returns an integer';
done_testing;

View file

@ -3,7 +3,7 @@
use strict;
use warnings;
use Test::More tests => 9;
use Test::More;
use lib "t/lib";
use SQLiteTest;
@ -53,3 +53,5 @@ SCOPE: {
ok( $dbh->do($create2), $create2 ) or diag("Error: '$DBI::errstr'");
ok( $dbh->disconnect, '->disconnect ok' );
}
done_testing;

View file

@ -4,7 +4,7 @@ use strict;
use warnings;
use lib "t/lib";
use SQLiteTest;
use Test::More tests => 6;
use Test::More;
use Test::NoWarnings;
SCOPE: {
@ -17,3 +17,5 @@ SCOPE: {
'INSERT ok',
);
}
done_testing;

View file

@ -3,7 +3,7 @@ use warnings;
my @to_be_tested;
BEGIN { @to_be_tested = (1.23E4); }
use Test::More tests => 2 + @to_be_tested;
use Test::More;
use lib "t/lib";
use SQLiteTest;
@ -19,3 +19,5 @@ SCOPE: {
ok( (@$av && $av->[0] == $to_be_tested[$id]), "accepts $to_be_tested[$id]: ".$av->[0]);
}
}
done_testing;

View file

@ -1,6 +1,6 @@
use strict;
use warnings;
use Test::More tests => 7;
use Test::More;
use lib "t/lib";
use SQLiteTest;
@ -42,3 +42,5 @@ like(
qr/attempt to fetch on inactive database handle/,
'Got the expected warning',
);
done_testing;

View file

@ -7,9 +7,7 @@ use lib "t/lib";
use SQLiteTest;
use Test::More;
BEGIN {
if ( $] >= 5.008005 ) {
plan( tests => 2 + 12 * (($^O eq 'cygwin') ? 2 : 4) );
} else {
unless ( $] >= 5.008005 ) {
plan( skip_all => 'Unicode is not supported before 5.8.5' );
}
}
@ -127,3 +125,5 @@ sub _path { # copied from DBD::SQLite::connect
}
return $path;
}
done_testing;

View file

@ -10,8 +10,6 @@ BEGIN { requires_sqlite('3.6.11') }
use Test::NoWarnings;
use DBI;
plan tests => 11 * @CALL_FUNCS + 1;
foreach my $call_func (@CALL_FUNCS) {
# Connect to the test db and add some stuff:
my $foo = connect_ok( dbfile => 'foo', RaiseError => 1 );
@ -109,3 +107,5 @@ foreach my $call_func (@CALL_FUNCS) {
$foo->disconnect;
}
done_testing;

View file

@ -2,7 +2,7 @@ use strict;
use warnings;
use lib "t/lib";
use SQLiteTest;
use Test::More tests => 22;
use Test::More;
use Test::NoWarnings;
my @catalog_info = (
@ -139,3 +139,5 @@ is_deeply $info, [$table2_info, @systable_info, $table4_info, $table3_info, $tab
#warn 'Schema Names', substr Dumper($dbh->table_info('', '%', '')->fetchall_arrayref), 5;
#warn 'Table Types', substr Dumper($dbh->table_info('', '', '', '%')->fetchall_arrayref), 5;
#warn 'table_info', substr Dumper($info), 5;
done_testing;

View file

@ -7,8 +7,6 @@ use Test::NoWarnings qw/had_no_warnings clear_warnings/;
use DBD::SQLite;
plan tests => 24 * @CALL_FUNCS + 1;
# hooks : just count the commits / rollbacks / updates
my ($n_commits, $n_rollbacks, $n_updates, @update_args);
sub commit_hook { $n_commits += 1; return 0; }
@ -143,3 +141,5 @@ sub do_transaction {
}
$dbh->commit;
}
done_testing;

View file

@ -19,8 +19,6 @@ BEGIN {
}
}
plan tests => 2 * (3 + 2 * @regexes) * @CALL_FUNCS;
BEGIN {
# Sadly perl for windows (and probably sqlite, too) may hang
# if the system locale doesn't support european languages.
@ -83,3 +81,5 @@ foreach my $call_func (@CALL_FUNCS) {
}
}
}
done_testing;

View file

@ -5,8 +5,6 @@ use SQLiteTest qw/connect_ok/;
use Test::More;
use Test::NoWarnings;
plan tests => 8;
my $dbh = connect_ok( RaiseError => 1 );
eval { $dbh->do("\n") };
@ -32,3 +30,5 @@ diag $@ if $@;
eval { $dbh->do(undef) };
ok !$@, "undef statement does not spit a warning, and does not die anyway";
diag $@ if $@;
done_testing;

View file

@ -8,8 +8,6 @@ BEGIN { requires_sqlite('3.6.19') }
use Test::NoWarnings;
plan tests => 17;
# following tests are from http://www.sqlite.org/foreignkeys.html
my $dbh = connect_ok( RaiseError => 1, PrintError => 0, AutoCommit => 1 );
@ -71,3 +69,5 @@ sub insert_track { _do("INSERT INTO track (trackid, trackname, trackartist) VAL
sub update_track { _do("UPDATE track SET trackartist = ? WHERE trackname = ?", @_); }
sub _do { eval { $dbh->do(shift, undef, @_) }; }
done_testing;

View file

@ -5,8 +5,6 @@ use SQLiteTest qw/connect_ok/;
use Test::More;
use Test::NoWarnings;
plan tests => 21;
{
# DBD::SQLite prepares/does the first statement only;
# the following statements will be discarded silently.
@ -126,3 +124,5 @@ plan tests => 21;
ok $got->[0][0] == 1
&& $got->[1][0] == 2, "and got the inserted values";
}
done_testing;

View file

@ -5,8 +5,6 @@ use SQLiteTest qw/connect_ok/;
use Test::More;
use Test::NoWarnings;
plan tests => 13;
my $dbh = connect_ok( RaiseError => 1 );
ok $dbh->do('create table foo (id integer, value integer)');
@ -52,3 +50,5 @@ SKIP: {
ok $count == 2;
}
done_testing;

View file

@ -5,8 +5,6 @@ use SQLiteTest qw/connect_ok/;
use Test::More;
use Test::NoWarnings;
plan tests => (5 * 5) + (3 * 6 + 1) + (5 * 2) + 1;
for my $quote ('', qw/' " ` []/) {
my ($begin_quote, $end_quote) = (substr($quote, 0, 1), substr($quote, -1, 1));
my $dbh = connect_ok( RaiseError => 1 );
@ -113,3 +111,5 @@ for my $quote ('', qw/' " ` []/) {
is $pk_info[0]{PK_NAME} => 'bar', "pk name is correct";
}
}
done_testing;

View file

@ -37,11 +37,6 @@ BEGIN {
# Perl may spit a warning on locale
# use Test::NoWarnings;
my $num = has_sqlite('3.7.4') ? 4 : 2;
plan tests => $num * @tests # each test with unicode y/n and with fts3/fts4
+ 2; # connect_ok with unicode y/n
BEGIN {
# Sadly perl for windows (and probably sqlite, too) may hang
# if the system locale doesn't support european languages.
@ -112,3 +107,5 @@ for my $use_unicode (0, 1) {
}
}
}
done_testing;

View file

@ -54,8 +54,6 @@ BEGIN {
}
use Test::NoWarnings;
plan tests => @coords + (2 * @test_regions) + 4;
# connect
my $dbh = connect_ok( RaiseError => 1 );
@ -106,3 +104,5 @@ for my $region (@test_regions) {
my $results = $dbh->selectcol_arrayref($overlap_sql, undef, @$region);
is_deeply_approx($results, shift @test_results);
}
done_testing;

View file

@ -6,7 +6,6 @@ use Test::More;
BEGIN { requires_sqlite('3.6.8') }
plan tests => 5;
use Test::NoWarnings;
my $dbh = connect_ok(
@ -41,3 +40,5 @@ is $dbh->selectrow_array("SELECT COUNT(*) FROM MST"), 0,
"savepoint rolled back";
$dbh->rollback;
done_testing;

View file

@ -8,9 +8,6 @@ BEGIN {
if ($@) {
plan skip_all => 'requires APR::Table';
}
else {
plan tests => 2;
}
}
my $dbh = connect_ok(
@ -21,3 +18,5 @@ my $dbh = connect_ok(
eval { $dbh->do('SELECT 1') };
ok !$@, "no errors";
diag $@ if $@;
done_testing;

View file

@ -7,8 +7,6 @@ use SQLiteTest qw/connect_ok dbfile @CALL_FUNCS/;
use Test::More;
use Test::NoWarnings;
plan tests => 10 * @CALL_FUNCS + 1;
foreach my $call_func (@CALL_FUNCS) {
my $dbh = connect_ok(
@ -77,3 +75,5 @@ foreach my $call_func (@CALL_FUNCS) {
unlink $dbfile;
}
done_testing;

View file

@ -8,8 +8,6 @@ use DBI qw(:sql_types);
use Test::More;
use Test::NoWarnings;
plan tests => 10 + 1;
my $dbh = connect_ok(
RaiseError => 1,
PrintError => 0,
@ -41,3 +39,5 @@ $dbh->commit;
$dbh->disconnect;
undef($dbh);
done_testing;

View file

@ -8,8 +8,6 @@ BEGIN { requires_sqlite('3.6.21') }
use Test::NoWarnings;
plan tests => 12 * @CALL_FUNCS + 1;
my $flag = 0;
for my $call_func (@CALL_FUNCS) {
my $dbh = connect_ok();
@ -57,3 +55,5 @@ for my $call_func (@CALL_FUNCS) {
is $profile[2][0] => "insert into bar values (?)";
like $profile[2][1] => qr/^[0-9]+$/;
}
done_testing;

View file

@ -52,8 +52,6 @@ CREATE TABLE song(
);
__EOSQL__
plan tests => @sql_statements + 22;
my $dbh = connect_ok( RaiseError => 1, PrintError => 0, AutoCommit => 1 );
my $sth;
my $fk_data;
@ -114,3 +112,5 @@ for ($fk_data->{songartist}) {
for ($fk_data->{songalbum}) {
is($_->{KEY_SEQ}, 2, "FK song, key seq 2");
}
done_testing;

View file

@ -13,8 +13,6 @@ use lib "t/lib";
use SQLiteTest qw/connect_ok @CALL_FUNCS/;
use Test::NoWarnings;
plan tests => 16 * @CALL_FUNCS + 1;
for my $call_func (@CALL_FUNCS) {
my $dbh = connect_ok(RaiseError => 1);
$dbh->do('create table foo (id integer primary key autoincrement, "name space", unique_col integer unique)');
@ -58,3 +56,5 @@ for my $call_func (@CALL_FUNCS) {
ok $@, "successfully died when dbh is inactive";
}
}
done_testing;

View file

@ -8,8 +8,6 @@ BEGIN { requires_sqlite('3.7.10') }
use Test::NoWarnings;
plan tests => 6 * @CALL_FUNCS + 1;
for my $func (@CALL_FUNCS) {
{
my $db = filename($func);
@ -33,3 +31,5 @@ sub filename {
my $dbh = connect_ok(@_);
$dbh->$func('db_filename');
}
done_testing;

View file

@ -5,12 +5,6 @@ use SQLiteTest qw/connect_ok @CALL_FUNCS has_sqlite/;
use Test::More;
use Test::NoWarnings;
my $tests = 3;
$tests += 2 if has_sqlite('3.6.4');
$tests += 1 if has_sqlite('3.7.0');
plan tests => 4 + $tests * @CALL_FUNCS + 1;
my $dbh = connect_ok();
{
$dbh->do('create table foo (id integer primary key, text)');
@ -52,3 +46,5 @@ for my $func (@CALL_FUNCS) {
}
}
}
done_testing;

View file

@ -2,7 +2,7 @@ use strict;
use warnings;
use lib "t/lib";
use SQLiteTest qw/connect_ok/;
use Test::More tests => 5;
use Test::More;
use Test::NoWarnings;
my $dbh = connect_ok();
@ -21,3 +21,5 @@ $dbh->do("\nCOMMIT");
is $dbh->{AutoCommit}, 1,
'AutoCommit=1 after "\nCOMMIT"';
done_testing;

View file

@ -40,8 +40,6 @@ CREATE TABLE remote.b (
__EOSQL__
plan tests => @sql_statements + 2 + 46 * 2;
my $dbh = connect_ok( RaiseError => 1, PrintError => 0, AutoCommit => 1 );
my $sth;
my $stats_data;
@ -116,3 +114,5 @@ for my $table_name ('a', 'A') {
}
ok(not(exists $stats_data->{a_ln}->{3}), "only two indexes in a_an index");
}
done_testing;

View file

@ -3,11 +3,6 @@ use warnings;
use lib "t/lib";
use SQLiteTest;
use Test::More;
my $tests = 7;
$tests += 1 if has_sqlite('3.7.7');
plan tests => $tests;
use DBI;
use DBD::SQLite;
@ -105,3 +100,5 @@ if (has_sqlite('3.7.7')) {
$dbh->disconnect;
unlink $dbfile if -f $dbfile;
}
done_testing;

View file

@ -6,7 +6,6 @@ use Test::More;
BEGIN { requires_sqlite('3.7.7') }
plan tests => 17;
use DBI;
use DBD::SQLite;
@ -219,3 +218,5 @@ cleanup();
$dbh->disconnect;
cleanup();
}
done_testing;

View file

@ -6,8 +6,6 @@ use Test::More;
use Test::NoWarnings;
use DBI qw(:sql_types);
plan tests => 9;
# The following is by mje++
# http://pastebin.com/RkUwwVti
@ -66,3 +64,5 @@ $sth->bind_param(1, 1, SQL_INTEGER);
$sth->bind_param(2, $test_value, SQL_VARCHAR);
$sth->execute;
my_is($dbh, "prepared insert with provided bound data and type SQL_VARCHAR see_if_its_a_number=0");
done_testing;

View file

@ -14,8 +14,6 @@ use Test::NoWarnings;
use DBD::SQLite::Constants qw/:extended_result_codes :result_codes/;
use File::Temp;
plan tests => 18;
my $tmpdir = File::Temp::tempdir(CLEANUP => 1);
ok -d $tmpdir;
@ -50,3 +48,5 @@ for my $flag (0, 1) {
my $err = DBI->err;
is $err => $expected{$flag};
}
done_testing;

View file

@ -9,8 +9,6 @@ BEGIN { requires_sqlite('3.7.11') }
use Test::NoWarnings;
plan tests => 14;
{
my $dbh = connect_ok(
sqlite_open_flags => SQLITE_OPEN_READONLY,
@ -40,3 +38,5 @@ plan tests => 14;
# told so)
ok $dbh->do('CREATE TABLE foo (id)');
}
done_testing;

View file

@ -9,8 +9,6 @@ BEGIN { requires_sqlite('3.10.0'); }
use Test::NoWarnings;
plan tests => 13;
ok !DBD::SQLite::strlike("foo_bar", "FOO1BAR");
ok !DBD::SQLite::strlike("foo_bar", "FOO_BAR");
ok DBD::SQLite::strlike("foo\\_bar", "FOO1BAR", "\\");
@ -23,3 +21,5 @@ ok DBD::SQLite::strlike("\\%foobar", "1FOOBAR", "\\");
ok !DBD::SQLite::strlike("\\%foobar", "%FOOBAR", "\\");
ok DBD::SQLite::strlike("!%foobar", "1FOOBAR", "!");
ok !DBD::SQLite::strlike("!%foobar", "%FOOBAR", "!");
done_testing;

View file

@ -16,8 +16,6 @@ my @words = ("\x{e3}\x{83}\x{86}\x{e3}\x{82}\x{b9}\x{e3}\x{83}\x{88}", "\x{e3}\x
my $regex = "\x{e3}\x{83}\x{86}[\x{e3}\x{82}\x{b9}\x{e3}\x{83}\x{b3}]\x{e3}\x{83}\x{88}"; # テ[スン]ト
plan tests => 2 * 2 * @CALL_FUNCS;
foreach my $call_func (@CALL_FUNCS) {
for my $use_unicode (0, 1) {
@ -45,3 +43,5 @@ foreach my $call_func (@CALL_FUNCS) {
note explain $db_match;
}
}
done_testing;

View file

@ -5,8 +5,6 @@ use SQLiteTest qw/connect_ok/;
use Test::More;
use Test::NoWarnings;
plan tests => 7;
my $dbh = connect_ok( RaiseError => 1 );
ok $dbh->do('create table foo (id integer, value integer)');
{
@ -28,3 +26,5 @@ ok $dbh->do('create table foo (id integer, value integer)');
my $sth = $dbh->prepare('select * from foo where id = ?');
is_deeply $sth->{ParamValues} => {1 => undef}, "ParamValues without binding";
}
done_testing;

View file

@ -5,8 +5,6 @@ use SQLiteTest qw/connect_ok @CALL_FUNCS/;
use Test::More;
use DBD::SQLite::Constants qw/SQLITE_LIMIT_VARIABLE_NUMBER/;
plan tests => 7 * @CALL_FUNCS;
for my $func (@CALL_FUNCS) {
my $dbh = connect_ok(PrintError => 0, RaiseError => 1);
my $current_limit = $dbh->$func(SQLITE_LIMIT_VARIABLE_NUMBER, 'limit');
@ -22,3 +20,5 @@ for my $func (@CALL_FUNCS) {
eval { $dbh->do('insert into foo values(?, ?)', undef, 2, 'NOT OK') };
like $@ => qr/too many SQL variables/, "should raise error because of the variable limit";
}
done_testing;

View file

@ -5,8 +5,6 @@ use SQLiteTest qw/connect_ok @CALL_FUNCS/;
use Test::More;
use DBD::SQLite::Constants qw/:database_connection_configuration_options/;
plan tests => 38 * @CALL_FUNCS + 3;
# LOOKASIDE
for my $func (@CALL_FUNCS) {
SKIP: {
@ -215,3 +213,5 @@ SKIP: {
ok $@, "updating sqlite_master is prohibited";
like $@ => qr/table sqlite_master may not be modified/;
}
done_testing;

View file

@ -5,8 +5,6 @@ use SQLiteTest;
use Test::More;
use Test::NoWarnings;
plan tests => 3 * @CALL_FUNCS * 3 + 1;
# The following snippets are copied from Cookbook.pod by hand.
# Don't forget to update here when the pod is updated.
# Or, use/coin something like Test::Snippets for better synching.
@ -126,3 +124,5 @@ END_SQL
is $result->[1] => 1250;
}
}
done_testing;

View file

@ -6,7 +6,6 @@ use Test::More;
BEGIN { requires_sqlite('3.6.8') }
plan tests => 13;
use Test::NoWarnings;
{ # simple case
@ -154,3 +153,5 @@ use Test::NoWarnings;
$dbh->{AutoCommit} = 1;
# should not spit the "Issuing rollback()" warning
}
done_testing;

View file

@ -6,7 +6,6 @@ use Test::More;
BEGIN { requires_sqlite('3.6.8') }
plan tests => 2;
use Test::NoWarnings;
{ # simple case
@ -20,3 +19,5 @@ use Test::NoWarnings;
$dbh->commit;
# should not spit the "Issuing rollback()" warning
}
done_testing;

View file

@ -3,8 +3,6 @@ use warnings;
use lib "t/lib";
use SQLiteTest;
use Test::More;
plan tests => 14;
use Test::NoWarnings;
{
@ -30,3 +28,5 @@ use Test::NoWarnings;
is $info{bat}[1] => 4;
is $info{bat}[2] => 4;
}
done_testing;

View file

@ -5,8 +5,6 @@ use SQLiteTest;
use Test::More;
use Test::NoWarnings;
plan tests => 5;
my $sql_in_question = <<'EOS';
SELECT cdid
FROM cd me
@ -73,3 +71,5 @@ EOS
is_deeply $res => [[4], [5]], "got the expected result without the index" or note explain $res;
}
done_testing;

View file

@ -6,7 +6,7 @@ use strict;
use warnings;
use lib "t/lib";
use SQLiteTest;
use Test::More tests => 13;
use Test::More;
use Test::NoWarnings;
# Create a database
@ -68,3 +68,5 @@ SCOPE: {
'Query 2 Row 2',
);
}
done_testing;

View file

@ -2,7 +2,7 @@ use strict;
use warnings;
use lib "t/lib";
use SQLiteTest;
use Test::More tests => 11;
use Test::More;
use Test::NoWarnings;
SCOPE: {
@ -27,3 +27,5 @@ SCOPE: {
is_deeply( $sth2->fetchrow_arrayref, [ 'foo', 'bar', 2 ], 'Row 2 ok' );
ok( $sth2->finish, '->finish ok' );
}
done_testing;

View file

@ -4,9 +4,7 @@ use lib "t/lib";
use SQLiteTest;
use Test::More;
BEGIN {
if ( $] >= 5.008005 ) {
plan( tests => 23 );
} else {
unless ( $] >= 5.008005 ) {
plan( skip_all => 'Unicode is not supported before 5.8.5' );
}
}
@ -31,3 +29,5 @@ foreach ( "\0", "A", "\xe9", "\x{20ac}" ) {
is $match->[0][0], $_;
ok( $dbh->do("DELETE FROM foo"), 'DELETE ok' );
}
done_testing;

View file

@ -2,7 +2,7 @@ use strict;
use warnings;
use lib "t/lib";
use SQLiteTest;
use Test::More tests => 14;
use Test::More;
use Test::NoWarnings;
# Create the table
@ -55,3 +55,5 @@ is_deeply(
],
'group/sum/sort/limit query ok'
);
done_testing;

View file

@ -4,9 +4,7 @@ use lib "t/lib";
use SQLiteTest qw/connect_ok @CALL_FUNCS/;
use Test::More;
BEGIN {
if ( $] >= 5.008005 ) {
plan( tests => 15 * @CALL_FUNCS + 1);
} else {
unless ( $] >= 5.008005 ) {
plan( skip_all => 'Unicode is not supported before 5.8.5' );
}
}
@ -38,3 +36,5 @@ sub perl_uc {
my $string = shift;
return uc($string);
}
done_testing;

View file

@ -7,8 +7,6 @@ use SQLiteTest;
BEGIN { requires_sqlite('3.6.3') }
plan tests => 22;
use_ok('DBD::SQLite');
my $noprintquerymsg = '(Set ENV{PRINT_QUERY} to true value to see query)';
@ -95,6 +93,8 @@ foreach my $query (($query_with_parens, $query_without_parens)) {
$dbh->disconnect;
done_testing;
sub trim {
my ($string) = @_;
$string =~ s/^ \s+ //xms;

View file

@ -3,7 +3,7 @@ use strict;
use warnings;
use lib "t/lib";
use SQLiteTest;
use Test::More tests => 6;
use Test::More;
use Test::NoWarnings;
my $dbh = connect_ok( RaiseError => 1, AutoCommit => 1 );
@ -21,3 +21,5 @@ ok($sth2);
my $ret = eval { $sth2->execute(); "ok" };
ok !$@;
is($ret, 'ok');
done_testing;

View file

@ -3,7 +3,7 @@ use strict;
use warnings;
use lib "t/lib";
use SQLiteTest;
use Test::More tests => 9;
use Test::More;
use Test::NoWarnings;
use DBI qw(:sql_types);
@ -74,3 +74,5 @@ is( scalar(@$ar), 2, 'Got 2 results' );
# print "4: @$_\n" for @$ar;
is( scalar(@$ar), 2, "we got ".(@$ar)." items" );
#}
done_testing;

View file

@ -2,7 +2,7 @@ use strict;
use warnings;
use lib "t/lib";
use SQLiteTest;
use Test::More tests => 21;
use Test::More;
use Test::NoWarnings;
use DBI qw(:sql_types);
@ -88,3 +88,5 @@ is( $sth->fetchrow_arrayref->[0], 1, "result of: $tweaked_statement : [2]" );
$sth = $dbh->prepare($tweaked_statement);
ok( $sth->execute(2), "execute: $tweaked_statement : [2]" );
is( $sth->fetchrow_arrayref->[0], 1, "result of: $tweaked_statement : [2]" );
done_testing;

View file

@ -2,7 +2,7 @@ use strict;
use warnings;
use lib "t/lib";
use SQLiteTest;
use Test::More tests => 8;
use Test::More;
use Test::NoWarnings;
my $dbh = connect_ok( RaiseError => 1 );
@ -37,3 +37,5 @@ SCOPE: {
'f.f3' => 1,
}, 'Shortname row ok' );
}
done_testing;

View file

@ -6,7 +6,7 @@ use strict;
use warnings;
use lib "t/lib";
use SQLiteTest;
use Test::More tests => 32;
use Test::More;
use Test::NoWarnings;
# Create the table
@ -155,3 +155,5 @@ SCOPE: {
$dbh->disconnect;
is( $c, 1, 'No warnings' );
}
done_testing;

View file

@ -4,7 +4,7 @@ use strict;
use warnings;
use lib "t/lib";
use SQLiteTest;
use Test::More tests => 5;
use Test::More;
use Test::NoWarnings;
# Create a database
@ -18,3 +18,5 @@ ok( $dbh->do('INSERT INTO one ( num ) values ( 1 )'), 'insert' );
# Insert a duplicate
ok( ! $dbh->do('INSERT INTO one ( num ) values ( 1 )'), 'duplicate' );
done_testing;

View file

@ -2,7 +2,7 @@ use strict;
use warnings;
use lib "t/lib";
use SQLiteTest;
use Test::More tests => 4;
use Test::More;
use Test::NoWarnings;
my $dbh = connect_ok( RaiseError => 1, PrintError => 0 );
@ -13,3 +13,5 @@ ok $dbh->do("INSERT INTO nums (num) VALUES (?)", undef, 1);
eval { $dbh->do("INSERT INTO nums (num) VALUES (?)", undef, 1); };
ok $@ =~ /column num is not unique|UNIQUE constraint failed/, $@; # should not be a bus error
done_testing;

View file

@ -11,8 +11,6 @@ BEGIN {
}
}
plan tests => 6;
my $dbh = connect_ok();
ok $dbh->do("CREATE TABLE foo (id INTEGER PRIMARY KEY NOT NULL, col1 varchar(2) NOT NULL, col2 varchar(2), col3 char(2) NOT NULL)");
@ -28,3 +26,5 @@ my $expected = {
for my $m (keys %$expected) {
is_deeply($sth->{$m}, $expected->{$m});
}
done_testing;

View file

@ -13,8 +13,6 @@ BEGIN {
use Test::NoWarnings;
plan tests => 2;
my $file = 't/panic.pl';
open my $fh, '>', $file;
print $fh <DATA>;
@ -32,6 +30,8 @@ END {
unlink 'test.db' if -f 'test.db';
}
done_testing;
__DATA__
use strict;
use warnings;

View file

@ -17,8 +17,6 @@ BEGIN {
use Test::NoWarnings;
plan tests => 6;
my $dbh = connect_ok( RaiseError => 1, AutoCommit => 0 );
$dbh->do(<<EOF);
@ -54,3 +52,5 @@ sub insert_data {
$sth->execute($inc_num, $text) || die "execute failed\n";
$dbh->commit;
}
done_testing;

View file

@ -2,7 +2,7 @@ use strict;
use warnings;
use lib "t/lib";
use SQLiteTest;
use Test::More tests => 92 * 4 + 2;
use Test::More;
use Test::NoWarnings;
my $dbh = connect_ok(
@ -207,3 +207,5 @@ foreach my $func (@funcs) {
}
eval { $dbh->{AutoCommit} = 1 }; # to end transaction
$dbh->disconnect;
done_testing;

View file

@ -5,10 +5,8 @@ use SQLiteTest;
use Test::More;
BEGIN {
require DBD::SQLite;
if (DBD::SQLite->can('compile_options')
unless (DBD::SQLite->can('compile_options')
&& grep /ENABLE_ICU/, DBD::SQLite::compile_options()) {
plan( tests => 16 );
} else {
plan( skip_all => 'requires SQLite ICU plugin to be enabled' );
}
}
@ -89,3 +87,5 @@ utf8::encode($koenig);
is $got[$i] => $expected[$i], "got: $got[$i]";
}
}
done_testing;

View file

@ -10,8 +10,6 @@ my @methods = qw(
commit rollback
);
plan tests => 2 * (6 + @methods) + 2 * @CALL_FUNCS * (14 + ($DBD::SQLite::sqlite_version_number >= 3006011) * 2);
local $SIG{__WARN__} = sub {}; # to hide warnings/error messages
# DBI methods
@ -175,3 +173,5 @@ for my $call_func (@CALL_FUNCS) {
}
}
}
done_testing;

View file

@ -2,7 +2,7 @@ use strict;
use warnings;
use lib "t/lib";
use SQLiteTest;
use Test::More tests => 8;
use Test::More;
use Test::NoWarnings;
my $dbh = connect_ok(RaiseError => 1, PrintError => 0);
@ -13,3 +13,5 @@ ok $dbh->errstr, "has errstr";
ok $dbh->ping, "ping succeeded";
ok $dbh->err, "err is not wiped out";
ok $dbh->errstr, "errstr is not wiped out";
done_testing;

View file

@ -2,7 +2,7 @@ use strict;
use warnings;
use lib "t/lib";
use SQLiteTest qw/connect_ok/;
use Test::More tests => 34;
use Test::More;
use DBI qw/:sql_types/;
my $id = 0;
@ -139,3 +139,5 @@ for my $has_pk (0..1) {
$dbh->disconnect;
}
done_testing;

View file

@ -4,9 +4,7 @@ use lib "t/lib";
use SQLiteTest qw/connect_ok/;
use Test::More;
BEGIN {
if ( $] >= 5.008005 ) {
plan( tests => 50 );
} else {
unless ( $] >= 5.008005 ) {
plan( skip_all => 'Unicode is not supported before 5.8.5' );
}
}
@ -112,3 +110,5 @@ my $str = "\x{20ac}";
}
$sth->finish;
}
done_testing;

View file

@ -2,7 +2,7 @@ use strict;
use warnings;
use lib "t/lib";
use SQLiteTest;
use Test::More tests => 2;
use Test::More;
use DBI;
my $dbh = connect_ok(RaiseError => 1, PrintError => 0);
@ -31,3 +31,5 @@ eval {
$dbh->do('CREATE VIRTUAL TABLE FIXMESSAGE USING FTS3(MESSAGE, tokenize=perl, "main::locale_tokenizer");');
};
ok $@, "cause an error but not segfault";
done_testing;

View file

@ -2,7 +2,7 @@ use strict;
use warnings;
use lib "t/lib";
use SQLiteTest qw/connect_ok/;
use Test::More tests => 6;
use Test::More;
use Test::NoWarnings;
my $dbh = connect_ok(sqlite_see_if_its_a_number => 1);
@ -16,3 +16,5 @@ for my $value (qw/2e100 10.04e100/) {
};
ok !$@, "and without errors";
}
done_testing;

View file

@ -43,8 +43,6 @@ my @tests = qw(
2147483649
);
plan tests => 1 + @tests * 6 * 6;
my $dbh = connect_ok();
$dbh->do('
CREATE TABLE t (
@ -108,3 +106,5 @@ for my $val (@tests) {
}
}
}
done_testing;

View file

@ -2,7 +2,7 @@ use strict;
use warnings;
use lib "t/lib";
use SQLiteTest;
use Test::More tests => 4;
use Test::More;
use Test::NoWarnings;
my $dbh = connect_ok(RaiseError => 1, PrintError => 0);
@ -19,3 +19,5 @@ ok $row, 'Found the primary key column.';
is $row->{COLUMN_NAME} => "Country Code",
'Key column name reported correctly.'
or note explain $row;
done_testing;

View file

@ -5,11 +5,7 @@ use SQLiteTest;
use Test::More;
BEGIN {
if ( $] >= 5.008005 ) {
my $tests = 27;
$tests += 2 if has_sqlite('3.6.14');
plan( tests => $tests * 2 + 1 );
} else {
unless ( $] >= 5.008005 ) {
plan( skip_all => 'Unicode is not supported before 5.8.5' );
}
}
@ -161,3 +157,5 @@ sub unicode_test {
}
}
}
done_testing;

View file

@ -5,8 +5,6 @@ use SQLiteTest qw/connect_ok/;
use Test::More;
use Test::NoWarnings;
plan tests => 15 + 1;
# single column integer primary key
{
my $dbh = connect_ok();
@ -59,3 +57,5 @@ plan tests => 15 + 1;
@pk = map $_->{COLUMN_NAME}, sort {$a->{KEY_SEQ} <=> $b->{KEY_SEQ}} @pk_info;
is join(' ', @pk) => 'c"d b a', 'pk KEY_SEQ is correct';
}
done_testing;

View file

@ -2,7 +2,7 @@ use strict;
use warnings;
use lib "t/lib";
use SQLiteTest;
use Test::More tests => 3;
use Test::More;
use Test::NoWarnings;
my $dbh = connect_ok();
@ -44,3 +44,5 @@ $dbh->do($_) for (
);
pass "all done without segfault";
done_testing;

View file

@ -7,9 +7,6 @@ use SQLiteTest;
use Test::More;
use Test::NoWarnings;
my $tests = 2;
plan tests => 1 + $tests * @CALL_FUNCS + 1;
my $dbh = connect_ok( RaiseError => 1, PrintError => 0 );
for my $func (@CALL_FUNCS) {
my $filename = eval { $dbh->$func('db_filename') };
@ -22,3 +19,5 @@ for my $func (@CALL_FUNCS) {
my $filename = eval { $dbh->$func('db_filename') };
ok !$@ && !$filename, "got no error; no filename; and no segfault";
}
done_testing;

View file

@ -8,9 +8,7 @@ use lib "t/lib";
use SQLiteTest;
use Test::More;
BEGIN {
if ( $] >= 5.008005 ) {
plan( tests => 16 );
} else {
unless ( $] >= 5.008005 ) {
plan( skip_all => 'Unicode is not supported before 5.8.5' );
}
}
@ -34,3 +32,5 @@ foreach ( "A", "\xe9", "\x{20ac}" ) {
ok( $dbh->do("DELETE FROM foo"), 'DELETE ok' );
}
done_testing;

Some files were not shown because too many files have changed in this diff Show more