From a3ff0b1f7c81d58f71900691a2c945e4acfcb190 Mon Sep 17 00:00:00 2001 From: Adam Kennedy Date: Fri, 3 Apr 2009 14:25:58 +0000 Subject: [PATCH] All tests run under the same Perl environment (autoflush on, and warnings enabled via $^W = 1) --- Changes | 23 ++++-- Makefile.PL | 182 ++++++++++++++++++++++++----------------- t/00basic.t | 13 ++- t/01logon.t | 11 ++- t/02cr_table.t | 12 ++- t/03insert.t | 11 ++- t/04select.t | 11 ++- t/05tran.t | 11 ++- t/06error.t | 10 ++- t/07busy.t | 10 ++- t/08create_function.t | 3 +- t/09create_aggregate.t | 127 ++++++++++++++-------------- t/10dsnlist.t | 16 ++-- t/11unicode.t | 16 ++-- t/12create_collation.t | 9 +- t/13progress_handler.t | 10 ++- t/20createdrop.t | 16 ++-- t/30insertfetch.t | 15 ++-- t/40bindparam.t | 14 ++-- t/40blobs.t | 18 ++-- t/40blobtext.t | 10 ++- t/40listfields.t | 14 ++-- t/40nulls.t | 15 ++-- t/40numrows.t | 18 ++-- t/40prepcached.t | 21 +++-- t/50chopblanks.t | 14 ++-- t/50commit.t | 17 ++-- t/60metadata.t | 11 ++- t/70schemachange.t | 7 +- t/90cppcomments.t | 10 ++- t/ak-dbd.t | 16 ++-- t/column-info.t | 24 ++---- 32 files changed, 417 insertions(+), 298 deletions(-) diff --git a/Changes b/Changes index 911ef41..300aa8a 100644 --- a/Changes +++ b/Changes @@ -1,18 +1,23 @@ Revision history for Perl extension DBD-SQLite. 1.19_06 not yet released - - fixed a segv with an error function under x86 linux + - Fixed a segv with an error function under x86 linux (and hopefully Mac OSX). (TOKUHIROM) - - fixed yet another segv while testing DBIC reconnection (DMAKI) - - minor test improvement (ISHIGAKI) - - switched from Test.pm to Test::More (though there're still - some tests that don't use Test::More) - - added "use strict" to some. - - added a cleanup block to each test to allow it run clean and - separately. + - Fixed yet another segv while testing DBIC reconnection (DMAKI) + - Switched from Test.pm to Test::More (though there're still + some tests that don't use Test::More) (ISHIGAKI) + - Added "use strict" to some. (ISHIGAKI) + - Added a cleanup block to each test to allow it run clean and + separately. (ISHIGAKI) + - Adding an explicit minimum Perl version to the Makefile.PL (ADAMK) + - Setting configure_requires dependencies for File::Spec + - Splitting the LICENSE key into it's own MakeMaker + version-dependency conditional (ADAMK) + - All tests run under the same Perl environment + (autoflush on, and warnings enabled via $^W = 1) (ADAMK) 1.19_05 Thu 2 Apr 2009 - - DBD::SQLite::Amalgamation 3.6.1.2 and DBD::SQLite 1.19_04 + - DBD::SQLite::Amalgamation 3.6.1.2 and DBD::SQLite 1.19 should be feature identical now. - Added collations from DBD::SQLite::Amalgamation (CORION) - Removed statement handle activation after "execute" if diff --git a/Makefile.PL b/Makefile.PL index cb2c122..bc44f57 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -3,6 +3,20 @@ use strict; use ExtUtils::MakeMaker; use Config; +# Some dependencies need to be more aggressive on Windows +sub WINLIKE () { + return 1 if $^O eq 'MSWin32'; + return 1 if $^O eq 'cygwin'; + return ''; +} + +# Make setting optional MakeMaker parameters more readable +sub OPTIONAL { + return () unless $ExtUtils::MakeMaker::VERSION ge shift; + return @_; +} + +# Are we upgrading from a critically out of date version? eval { require DBD::SQLite; if ( $DBD::SQLite::VERSION < 1.0 ) { @@ -46,47 +60,38 @@ EOT # 2009/04/02 # But why do we need to use an older, system-installed library? # Let's always use the bundled one. -- ISHIGAKI - -require File::Spec; +# 2009/04/03 +# For the moment, while we're fixing things, this is reasonable. +# However, logic in the form "I lack knowledge, thereforce lets do +# it this way" is not a sufficiently robust decision making process. +# Let's find out the full story first, so we can make an informed +# decision to whether to do this. -- ADAMK my ($force_local, $sqlite_base, $sqlite_lib, $sqlite_inc); - -=begin dont_try_looking_for_a_buggy_library -if ( $sqlite_base = (grep(/SQLITE_LOCATION=.*/, @ARGV))[0] ) { - $sqlite_base =~ /=(.*)/; - $sqlite_base = $1; - $sqlite_lib = File::Spec->catdir( $sqlite_base, 'lib' ); - $sqlite_inc = File::Spec->catdir( $sqlite_base, 'include' ); -} -if ( $force_local = (grep(/USE_LOCAL_SQLITE=.*/, @ARGV))[0] ) { - $force_local =~ /=(.*)/; - $force_local = "$1" ? 1 : 0; - if ( $force_local ) { - # Keep these from making into CFLAGS/LDFLAGS - undef $sqlite_lib; - undef $sqlite_inc; +if ( 0 ) { + require File::Spec; + if ( $sqlite_base = (grep(/SQLITE_LOCATION=.*/, @ARGV))[0] ) { + $sqlite_base =~ /=(.*)/; + $sqlite_base = $1; + $sqlite_lib = File::Spec->catdir( $sqlite_base, 'lib' ); + $sqlite_inc = File::Spec->catdir( $sqlite_base, 'include' ); } -} - -# Now check for a compatible sqlite3 -unless ( $force_local ) { - my ($dir, $file, $fh, $version); - print "Checking installed SQLite version...\n" if $ENV{AUTOMATED_TESTING}; - if ( $sqlite_inc ) { - open($fh, '< ' . File::Spec->catfile($sqlite_inc, 'sqlite3.h')) - or die "Error opening sqlite3.h in $sqlite_inc: $!"; - while ( defined($_ = <$fh>) ) { - if (/\#define\s+SQLITE_VERSION_NUMBER\s+(\d+)/) { - $version = $1; - last; - } + if ( $force_local = (grep(/USE_LOCAL_SQLITE=.*/, @ARGV))[0] ) { + $force_local =~ /=(.*)/; + $force_local = "$1" ? 1 : 0; + if ( $force_local ) { + # Keep these from making into CFLAGS/LDFLAGS + undef $sqlite_lib; + undef $sqlite_inc; } - close($fh); - } else { - # Go hunting for the file (Matt: Add more dirs here as you see fit) - foreach $dir ( [ qw(usr include) ], [ qw(usr local include) ] ) { - $file = File::Spec->catfile('', @$dir, 'sqlite3.h'); - next unless (-f $file); - open($fh, "< $file") or die "Error opening $file: $!"; + } + + # Now check for a compatible sqlite3 + unless ( $force_local ) { + my ($dir, $file, $fh, $version); + print "Checking installed SQLite version...\n" if $ENV{AUTOMATED_TESTING}; + if ( $sqlite_inc ) { + open($fh, '< ' . File::Spec->catfile($sqlite_inc, 'sqlite3.h')) + or die "Error opening sqlite3.h in $sqlite_inc: $!"; while ( defined($_ = <$fh>) ) { if (/\#define\s+SQLITE_VERSION_NUMBER\s+(\d+)/) { $version = $1; @@ -94,20 +99,33 @@ unless ( $force_local ) { } } close($fh); - last if $version; + } else { + # Go hunting for the file (Matt: Add more dirs here as you see fit) + foreach $dir ( [ qw(usr include) ], [ qw(usr local include) ] ) { + $file = File::Spec->catfile('', @$dir, 'sqlite3.h'); + next unless (-f $file); + open($fh, "< $file") or die "Error opening $file: $!"; + while ( defined($_ = <$fh>) ) { + if (/\#define\s+SQLITE_VERSION_NUMBER\s+(\d+)/) { + $version = $1; + last; + } + } + close($fh); + last if $version; + } + } + unless ( $version && ($version >= 3006000) ) { + warn "SQLite version must be at least 3.6.0. No header file at that\n"; + warn "version or higher was found. Using the local version instead.\n"; + $force_local = 1; + undef $sqlite_lib; + undef $sqlite_inc; + } else { + print "Looks good\n" if $ENV{AUTOMATED_TESTING}; } } - unless ( $version && ($version >= 3006000) ) { - warn "SQLite version must be at least 3.6.0. No header file at that\n"; - warn "version or higher was found. Using the local version instead.\n"; - $force_local = 1; - undef $sqlite_lib; - undef $sqlite_inc; - } else { - print "Looks good\n" if $ENV{AUTOMATED_TESTING}; - } } -=cut # Use always the bundled one. # XXX: ... and this message should be more informative. @@ -115,7 +133,6 @@ unless ( $force_local ) { $force_local = 1; print "We're using the bundled sqlite library.\n" if $ENV{AUTOMATED_TESTING}; - @ARGV = grep( ! /SQLITE_LOCATION|USE_LOCAL_SQLITE/, @ARGV ); @@ -157,29 +174,7 @@ unless ( $Config{usethreads} ) { push @CC_DEFINE, '-DTHREADSAFE=0'; } -WriteMakefile( - NAME => 'DBD::SQLite', - ABSTRACT => 'Self Contained SQLite RDBMS in a DBI Driver', - VERSION_FROM => 'lib/DBD/SQLite.pm', - PREREQ_PM => { - 'DBI' => '1.21', - 'Test::More' => '0.42', - }, - ( $ExtUtils::MakeMaker::VERSION ge '6.46'? ( - 'LICENSE' => 'perl', - 'META_MERGE' => { - 'configure_requires' => { - DBI => '1.21', - }, - }, - ) : () ), - OBJECT => ( $force_local ? '$(O_FILES)' : 'SQLite.o dbdimp.o' ), - OPTIMIZE => '-O2', - clean => { - FILES => 'SQLite.xsi config.h tv.log output', - }, - PL_FILES => {}, - EXE_FILES => [], +my @CC_OPTIONS = ( INC => join( ' ', @CC_INC ), DEFINE => join( ' ', @CC_DEFINE ), ( @CC_LIBS ? ( @@ -187,6 +182,47 @@ WriteMakefile( ) : () ), ); + + + + +##################################################################### +# Hand off to ExtUtils::MakeMaker + +WriteMakefile( + NAME => 'DBD::SQLite', + ABSTRACT => 'Self Contained SQLite RDBMS in a DBI Driver', + VERSION_FROM => 'lib/DBD/SQLite.pm', + PREREQ_PM => { + 'DBI' => '1.21', + 'Test::More' => '0.42', + }, + OPTIONAL( '6.48', + MIN_PERL_VERSION => '5.005', + ), + OPTIONAL( '6.31', + LICENSE => 'perl', + ), + OPTIONAL( '6.46', + META_MERGE => { + configure_requires => { + 'ExtUtils::MakeMaker' => '6.48', + 'File::Spec' => (WINLIKE ? '3.27' : '0.82'), + 'DBI' => '1.21', + }, + }, + ), + OBJECT => ( $force_local ? '$(O_FILES)' : 'SQLite.o dbdimp.o' ), + OPTIMIZE => '-O2', + clean => { + FILES => 'SQLite.xsi config.h tv.log output', + }, + PL_FILES => {}, + EXE_FILES => [], + + @CC_OPTIONS, +); + package MY; sub postamble { diff --git a/t/00basic.t b/t/00basic.t index a29e9ca..7b593e7 100644 --- a/t/00basic.t +++ b/t/00basic.t @@ -1,4 +1,11 @@ +#!/usr/bin/perl + use strict; -use Test::More; -BEGIN { plan tests => 1 } -BEGIN { use_ok('DBD::SQLite') } +BEGIN { + $| = 1; + $^W = 1; +} + +use Test::More tests => 1; + +use_ok('DBD::SQLite'); diff --git a/t/01logon.t b/t/01logon.t index 158d10a..3e0ee0c 100644 --- a/t/01logon.t +++ b/t/01logon.t @@ -1,7 +1,14 @@ +#!/usr/bin/perl + use strict; -use Test::More; -BEGIN { plan tests => 5 } +BEGIN { + $| = 1; + $^W = 1; +} + +use Test::More tests => 5; use DBI; + my $dbh = DBI->connect("dbi:SQLite:dbname=foo", "", ""); ok($dbh); ok($dbh->{sqlite_version}); diff --git a/t/02cr_table.t b/t/02cr_table.t index 14f75b9..64df38a 100644 --- a/t/02cr_table.t +++ b/t/02cr_table.t @@ -1,8 +1,14 @@ -$|++; +#!/usr/bin/perl + use strict; -use Test::More; -BEGIN { plan tests => 4 } +BEGIN { + $| = 1; + $^W = 1; +} + +use Test::More tests => 4; use DBI; + my $dbh = DBI->connect("dbi:SQLite:dbname=foo", "", ""); ok($dbh); $dbh->{AutoCommit} = 1; diff --git a/t/03insert.t b/t/03insert.t index c89aeaf..20e3dbb 100644 --- a/t/03insert.t +++ b/t/03insert.t @@ -1,7 +1,14 @@ +#!/usr/bin/perl + use strict; -use Test::More; +BEGIN { + $| = 1; + $^W = 1; +} + +use Test::More tests => 11; use DBI; -BEGIN { plan tests => 11 } + my $dbh = DBI->connect("dbi:SQLite:dbname=foo", "", "", {AutoCommit => 1}); ok($dbh); $dbh->do("CREATE TABLE f (f1, f2, f3)"); diff --git a/t/04select.t b/t/04select.t index 3d3b8b3..68178a0 100644 --- a/t/04select.t +++ b/t/04select.t @@ -1,7 +1,14 @@ +#!/usr/bin/perl + use strict; -use Test::More; -BEGIN { plan tests => 21 } +BEGIN { + $| = 1; + $^W = 1; +} + +use Test::More tests => 21; use DBI; + my $dbh = DBI->connect("dbi:SQLite:dbname=foo", "", "", { RaiseError => 1, AutoCommit => 1 }); ok($dbh); $dbh->do("CREATE TABLE f (f1, f2, f3)"); diff --git a/t/05tran.t b/t/05tran.t index 80d8c97..45bc961 100644 --- a/t/05tran.t +++ b/t/05tran.t @@ -1,6 +1,13 @@ +#!/usr/bin/perl + use strict; -use Test::More; -BEGIN { plan tests => 2 } +BEGIN { + $| = 1; + $^W = 1; +} + +use Test::More tests => 2; + use DBI; unlink("foo"); my $dbh = DBI->connect("dbi:SQLite:dbname=foo", "", "", diff --git a/t/06error.t b/t/06error.t index 7116e32..1a3b6d8 100644 --- a/t/06error.t +++ b/t/06error.t @@ -1,6 +1,12 @@ +#!/usr/bin/perl + use strict; -use Test::More; -BEGIN { plan tests => 2 } +BEGIN { + $| = 1; + $^W = 1; +} + +use Test::More tests => 2; use DBI; unlink('foo'); diff --git a/t/07busy.t b/t/07busy.t index f98dbd9..01b1212 100644 --- a/t/07busy.t +++ b/t/07busy.t @@ -1,8 +1,12 @@ -#!perl +#!/usr/bin/perl use strict; -use Test::More; -BEGIN { plan tests => 8 } +BEGIN { + $| = 1; + $^W = 1; +} + +use Test::More tests => 8; use DBI; my $db = DBI->connect('dbi:SQLite:foo', '', '', diff --git a/t/08create_function.t b/t/08create_function.t index e2e443b..9aca4f7 100644 --- a/t/08create_function.t +++ b/t/08create_function.t @@ -2,7 +2,8 @@ use strict; BEGIN { - $| = 1; + $| = 1; + $^W = 1; } use Test::More tests => 18; diff --git a/t/09create_aggregate.t b/t/09create_aggregate.t index 81faa12..e2fed88 100644 --- a/t/09create_aggregate.t +++ b/t/09create_aggregate.t @@ -1,71 +1,72 @@ +#!/usr/bin/perl + use strict; - -package count_aggr; - -sub new { - bless { count => 0 }, shift; +BEGIN { + $| = 1; + $^W = 1; } -sub step { - $_[0]{count}++; - return; -} - -sub finalize { - my $c = $_[0]{count}; - $_[0]{count} = undef; - - return $c; -} - -package obj_aggregate; - -sub new { - bless { count => 0 }, shift; -} - -sub step { - $_[0]{count}++ - if defined $_[1]; -} - -sub finalize { - my $c = $_[0]{count}; - $_[0]{count} = undef; - return $c; -} - -package fail_aggregate; - -sub new { - my $class = shift; - if ( ref $class ) { - die "new() failed on request" - if $class->{'fail'} eq 'new'; - return undef - if $class->{'fail'} eq 'undef'; - return bless { %$class }, ref $class; - } else { - return bless { 'fail' => $_[0] }, $class; - } -} - -sub step { - die "step() failed on request" - if $_[0]{fail} eq 'step'; -} - -sub finalize { - die "finalize() failed on request" - if $_[0]{fail} eq 'finalize'; -} - -package main; - -use Test::More; -BEGIN { plan tests => 15 } +use Test::More tests => 15; use DBI; +# Create the aggregate test packages +SCOPE: { + package count_aggr; + + sub new { + bless { count => 0 }, shift; + } + + sub step { + $_[0]{count}++; + return; + } + + sub finalize { + my $c = $_[0]{count}; + $_[0]{count} = undef; + + return $c; + } + + package obj_aggregate; + + sub new { + bless { count => 0 }, shift; + } + + sub step { + $_[0]{count}++ if defined $_[1]; + } + + sub finalize { + my $c = $_[0]{count}; + $_[0]{count} = undef; + return $c; + } + + package fail_aggregate; + + sub new { + my $class = shift; + if ( ref $class ) { + die "new() failed on request" if $class->{'fail'} eq 'new'; + return undef if $class->{'fail'} eq 'undef'; + return bless { %$class }, ref $class; + } else { + return bless { 'fail' => $_[0] }, $class; + } + } + + sub step { + die "step() failed on request" if $_[0]{fail} eq 'step'; + } + + sub finalize { + die "finalize() failed on request" if $_[0]{fail} eq 'finalize'; + } +} + my $dbh = DBI->connect("dbi:SQLite:dbname=foo", "", "", { PrintError => 0 } ); ok($dbh); diff --git a/t/10dsnlist.t b/t/10dsnlist.t index 8b8f36f..c788541 100644 --- a/t/10dsnlist.t +++ b/t/10dsnlist.t @@ -1,12 +1,14 @@ -#!/usr/local/bin/perl -# -# $Id: 10dsnlist.t,v 1.1.1.1 1999/06/13 12:59:35 joe Exp $ -# -# This test creates a database and drops it. Should be executed -# after listdsn. -# +#!/usr/bin/perl + +# This test creates a database and drops it. Should be executed +# after listdsn. use strict; +BEGIN { + $| = 1; + $^W = 1; +} + use vars qw($test_dsn $test_user $test_password $mdriver $state); # diff --git a/t/11unicode.t b/t/11unicode.t index fb40bdc..ab39dcd 100644 --- a/t/11unicode.t +++ b/t/11unicode.t @@ -1,13 +1,13 @@ -#!/usr/local/bin/perl -# -# $Id: 40blobs.t,v 1.5 2004/07/21 20:50:45 matt Exp $ -# -# This is a test for correct handling of the "unicode" database -# handle parameter. -# +#!/usr/bin/perl + +# This is a test for correct handling of the "unicode" database +# handle parameter. -$^W = 1; use strict; +BEGIN { + $| = 1; + $^W = 1; +} # # Include std stuff diff --git a/t/12create_collation.t b/t/12create_collation.t index 432dece..f5be64e 100644 --- a/t/12create_collation.t +++ b/t/12create_collation.t @@ -1,3 +1,11 @@ +#!/usr/bin/perl + +use strict; +BEGIN { + $| = 1; + $^W = 1; +} + BEGIN { local $@; unless (eval { require Test::More; require Encode; 1 }) { @@ -6,7 +14,6 @@ BEGIN { } } -use strict; use Test::More tests => 8; use DBI; use Encode qw/decode/; diff --git a/t/13progress_handler.t b/t/13progress_handler.t index 5f87abc..1aac8a1 100644 --- a/t/13progress_handler.t +++ b/t/13progress_handler.t @@ -1,6 +1,12 @@ +#!/usr/bin/perl + use strict; -use Test::More; -BEGIN { plan tests => 3; } +BEGIN { + $| = 1; + $^W = 1; +} + +use Test::More tests => 3; use DBI; my $N_OPCODES = 50; # how many opcodes before calling the progress handler diff --git a/t/20createdrop.t b/t/20createdrop.t index 5c8a6f8..118aded 100644 --- a/t/20createdrop.t +++ b/t/20createdrop.t @@ -1,12 +1,14 @@ -#!/usr/local/bin/perl -# -# $Id: 20createdrop.t,v 1.1.1.1 1999/06/13 12:59:35 joe Exp $ -# -# This is a skeleton test. For writing new tests, take this file -# and modify/extend it. -# +#!/usr/bin/perl + +# This is a skeleton test. For writing new tests, take this file +# and modify/extend it. use strict; +BEGIN { + $| = 1; + $^W = 1; +} + use vars qw($test_dsn $test_user $test_password $mdriver $dbdriver); $DBI::errstr = ''; # Make -w happy require DBI; diff --git a/t/30insertfetch.t b/t/30insertfetch.t index 766df07..188faf1 100644 --- a/t/30insertfetch.t +++ b/t/30insertfetch.t @@ -1,13 +1,14 @@ -#!/usr/local/bin/perl -# -# $Id: 30insertfetch.t,v 1.1 2002/02/19 17:19:57 matt Exp $ -# -# This is a simple insert/fetch test. -# +#!/usr/bin/perl + +# This is a simple insert/fetch test. use strict; +BEGIN { + $| = 1; + $^W = 1; +} + use vars qw($test_dsn $test_user $test_password $mdriver $state); -$^W = 1; # # Make -w happy diff --git a/t/40bindparam.t b/t/40bindparam.t index 4452fea..6cb7c97 100644 --- a/t/40bindparam.t +++ b/t/40bindparam.t @@ -1,14 +1,12 @@ -#!/usr/local/bin/perl -# -# $Id: 40bindparam.t,v 1.5 2002/12/29 16:24:55 matt Exp $ -# -# This is a skeleton test. For writing new tests, take this file -# and modify/extend it. -# +#!/usr/bin/perl use strict; +BEGIN { + $| = 1; + $^W = 1; +} + use vars qw($test_dsn $test_user $test_password $mdriver $state); -$^W = 1; # # Make -w happy diff --git a/t/40blobs.t b/t/40blobs.t index ac72a4c..f974fb5 100644 --- a/t/40blobs.t +++ b/t/40blobs.t @@ -1,15 +1,15 @@ -#!/usr/local/bin/perl -# -# $Id: 40blobs.t,v 1.4 2003/07/31 14:09:16 matt Exp $ -# -# This is a test for correct handling of BLOBS; namely $dbh->quote -# is expected to work correctly. -# +#!/usr/bin/perl + +# This is a test for correct handling of BLOBS; namely $dbh->quote +# is expected to work correctly. use strict; -use vars qw($test_dsn $test_user $test_password $mdriver $dbdriver $state); -$^W = 1; +BEGIN { + $| = 1; + $^W = 1; +} +use vars qw($test_dsn $test_user $test_password $mdriver $dbdriver $state); # # Make -w happy diff --git a/t/40blobtext.t b/t/40blobtext.t index 84069d7..6245bce 100644 --- a/t/40blobtext.t +++ b/t/40blobtext.t @@ -1,8 +1,12 @@ -#!/usr/bin/perl -w +#!/usr/bin/perl use strict; -use Test::More; -BEGIN { plan tests => 26 } +BEGIN { + $| = 1; + $^W = 1; +} + +use Test::More tests => 26; use DBI; unlink('foo', 'foo-journal'); diff --git a/t/40listfields.t b/t/40listfields.t index 0c66d09..92edfc7 100644 --- a/t/40listfields.t +++ b/t/40listfields.t @@ -1,11 +1,13 @@ -#!/usr/local/bin/perl -# -# $Id: 40listfields.t,v 1.1.1.1 1999/06/13 12:59:35 joe Exp $ -# -# This is a test for statement attributes being present appropriately. -# +#!/usr/bin/perl + +# This is a test for statement attributes being present appropriately. use strict; +BEGIN { + $| = 1; + $^W = 1; +} + use vars qw($test_dsn $test_user $test_password $mdriver $dbdriver $state $COL_KEY $COL_NULLABLE); # diff --git a/t/40nulls.t b/t/40nulls.t index 2004db9..8b55de5 100644 --- a/t/40nulls.t +++ b/t/40nulls.t @@ -1,9 +1,12 @@ -#!/usr/local/bin/perl -# -# $Id: 40nulls.t,v 1.1.1.1 1999/06/13 12:59:35 joe Exp $ -# -# This is a test for correctly handling NULL values. -# +#!/usr/bin/perl + +# This is a test for correctly handling NULL values. + +use strict; +BEGIN { + $| = 1; + $^W = 1; +} use strict; use vars qw($test_dsn $test_user $test_password $mdriver $dbdriver $state); diff --git a/t/40numrows.t b/t/40numrows.t index d2ec60b..d511373 100644 --- a/t/40numrows.t +++ b/t/40numrows.t @@ -1,17 +1,15 @@ -#!/usr/local/bin/perl -# -# $Id: 40numrows.t,v 1.1 2002/02/19 17:19:57 matt Exp $ -# -# This tests, whether the number of rows can be retrieved. -# +#!/usr/bin/perl + +# This tests, whether the number of rows can be retrieved. use strict; +BEGIN { + $| = 1; + $^W = 1; +} + use vars qw($test_dsn $test_user $test_password $mdriver $state); -$^W = 1; -$| = 1; - - # # Make -w happy # diff --git a/t/40prepcached.t b/t/40prepcached.t index a25738c..92496ae 100644 --- a/t/40prepcached.t +++ b/t/40prepcached.t @@ -1,18 +1,17 @@ -#!/usr/local/bin/perl -# -# $Id: 40numrows.t,v 1.2 2003/08/11 21:51:14 matt Exp $ -# -# This is a regression test for bug #15186: -# http://rt.cpan.org/Public/Bug/Display.html?id=15186 -# About re-using statements with prepare_cached(). +#!/usr/bin/perl + +# This is a regression test for bug #15186: +# http://rt.cpan.org/Public/Bug/Display.html?id=15186 +# About re-using statements with prepare_cached(). use strict; +BEGIN { + $| = 1; + $^W = 1; +} + use vars qw($test_dsn $test_user $test_password $mdriver $state); -$^W = 1; -$| = 1; - - # # Make -w happy # diff --git a/t/50chopblanks.t b/t/50chopblanks.t index baee9a4..8913103 100644 --- a/t/50chopblanks.t +++ b/t/50chopblanks.t @@ -1,11 +1,12 @@ -#!/usr/local/bin/perl -# -# $Id: 50chopblanks.t,v 1.1 2002/02/19 17:19:57 matt Exp $ -# -# This driver should check whether 'ChopBlanks' works. -# +#!/usr/bin/perl + +# Check whether 'ChopBlanks' works. use strict; +BEGIN { + $| = 1; + $^W = 1; +} # # Make -w happy @@ -21,7 +22,6 @@ $test_password = ''; # Include lib.pl # use DBI; -use strict; $mdriver = ""; { my $file; diff --git a/t/50commit.t b/t/50commit.t index 8d3aea5..e7954d1 100644 --- a/t/50commit.t +++ b/t/50commit.t @@ -1,16 +1,15 @@ -#!/usr/local/bin/perl -# -# $Id: 50commit.t,v 1.1.1.1 1999/06/13 12:59:35 joe Exp $ -# -# This is testing the transaction support. -# +#!/usr/bin/perl + +# This is testing the transaction support. use strict; +BEGIN { + $| = 1; + $^W = 1; +} + use vars qw($test_dsn $test_user $test_password $mdriver $state); -$^W = 1; - - # # Include lib.pl # diff --git a/t/60metadata.t b/t/60metadata.t index 93409df..b59a33d 100644 --- a/t/60metadata.t +++ b/t/60metadata.t @@ -1,7 +1,14 @@ +#!/usr/bin/perl + use strict; -use Test::More; -BEGIN { plan tests => 27 } +BEGIN { + $| = 1; + $^W = 1; +} + +use Test::More tests => 27; use DBI; + my $dbh = DBI->connect("dbi:SQLite:dbname=foo", "", "", { }); ok($dbh); $dbh->{PrintError} = 0; diff --git a/t/70schemachange.t b/t/70schemachange.t index 29757f7..8a609d5 100644 --- a/t/70schemachange.t +++ b/t/70schemachange.t @@ -1,6 +1,11 @@ -#!/usr/bin/perl -w +#!/usr/bin/perl use strict; +BEGIN { + $| = 1; + $^W = 1; +} + use vars qw($test_dsn $test_user $test_password $mdriver $dbdriver); if ($^O eq 'MSWin32') { diff --git a/t/90cppcomments.t b/t/90cppcomments.t index 6651192..a3e2d78 100644 --- a/t/90cppcomments.t +++ b/t/90cppcomments.t @@ -1,7 +1,15 @@ +#!/usr/bin/perl + use strict; +BEGIN { + $| = 1; + $^W = 1; +} + use Test::More; -use DBI; use Fatal qw(open); +use DBI; + my @c_files = <*.c>, <*.xs>; plan tests => scalar(@c_files); diff --git a/t/ak-dbd.t b/t/ak-dbd.t index 18a9a7a..cc0b840 100644 --- a/t/ak-dbd.t +++ b/t/ak-dbd.t @@ -1,16 +1,10 @@ -#!/usr/local/bin/perl -# -# $Id: ak-dbd.t,v 1.2 2002/02/19 18:51:01 matt Exp $ -# -# This is a skeleton test. For writing new tests, take this file -# and modify/extend it. -# +#!/usr/bin/perl use strict; - -$^W = 1; -$| = 1; - +BEGIN { + $| = 1; + $^W = 1; +} # # Make -w happy diff --git a/t/column-info.t b/t/column-info.t index 60e6a95..94427a7 100644 --- a/t/column-info.t +++ b/t/column-info.t @@ -1,22 +1,12 @@ -#!/usr/bin/perl -w -BEGIN { - local $@; - unless (eval { require Test::More; 1 }) { - print "1..0 # Skip need Test::More\n"; - exit; - } -} -use strict; -use Test::More tests => 7; +#!/usr/bin/perl +use strict; BEGIN { - use_ok 'DBD::SQLite' - or BAIL_OUT 'DBD::SQLite(::Amalgamation) failed to load. No sense in continuing.'; - no warnings 'once'; - #diag "Testing DBD::SQLite version '$DBD::SQLite::VERSION' on DBI '$DBI::VERSION'"; - - #*DBD::SQLite::db::column_info = \&DBD::SQLite::db::_sqlite_column_info; -}; + $| = 1; + $^W = 1; +} + +use Test::More tests => 6; use DBI; my $dbh = DBI->connect('dbi:SQLite:dbname=:memory:',undef,undef,{RaiseError => 1});