Test::More is working fine, but it is not printing out the name of the test when it runs the test, even though I have something in the name argument to the
is() API call. Does anyone know why? Full code of a file named
limit.t run via
make test enclosed
limit.t
# Before `make install' is performed this script should be runnable wi
+th
# `make test'. After `make install' it should work as `perl 1.t'
#########################
# change 'tests => 1' to 'tests => last_test_to_print';
use strict;
use warnings;
use Test::More tests => 2;
use SQL::AnyDBD;
#########################
# Insert your test code below, the Test::More module is use()ed here s
+o read
# its man page ( perldoc Test::More ) for help writing this test scrip
+t.
############################
## get DB connection info ##
############################
unless ( $ENV{DBI_DSN} and $ENV{DBI_USER} and $ENV{DBI_PASS} ) {
warn "A working DBI connection is required for the remaining tests
+.\n";
warn "Please enter the following parameters (or pre-set in your EN
+V):\n";
}
sub get_line {
warn " $_[0] (or accept default '$_[1]'): \n";
chomp( my $input = <STDIN> );
return length($input) ? $input : $_[1]
}
my $dsn = $ENV{DBI_DSN} || get_line(DBI_DSN => 'dbi:Pg:dbname=test')
+;
my $user = $ENV{DBI_USER} || get_line(DBI_USER => 'metaperl');
my $pass = $ENV{DBI_PASS} || get_line(DBI_PASS => '');
######################
## import test data ##
######################
my $dbh = DBI->connect($dsn, $user, $pass);
die "Unable to connect to DB for testing!" unless $dbh;
warn $dsn;
my $rows_desired = 8;
my $start_row = 4;
my $sb = SQL::AnyDBD->new($dbh);
my $sql = $sb->LIMIT(rows_desired => $rows_desired, start_row => $star
+t_row);
my %expect =
( Pg => [ 'LIMIT 8 OFFSET 4', 'LIMIT 8' ] );
my $driver = $dbh->{Driver}->{Name};
my $expect;
sub next_expect {
$expect = shift @ { $expect{$driver} } ;
}
next_expect;
is ( $sql , $expect, 'LIMIT with rows_desired and start_row' ) ;
$start_row = '';
next_expect;
$sql = $sb->LIMIT(rows_desired => $rows_desired, start_row => $start_r
+ow);
is ( $sql , $expect, 'LIMIT with rows_desired no start_row passed' ) ;
output
~/hacks/SQL/AnyDBD $ make test
/usr/bin/perl.exe "-MExtUtils::Command::MM" "-e" "test_harness(0, 'bli
+b/lib', 'blib/arch')" t/*.t
t/1........
+
t/1........ok 1/1
+
t/1........ok
t/limit....A working DBI connection is required for the remaining test
+s.
Please enter the following parameters (or pre-set in your ENV):
DBI_DSN (or accept default 'dbi:Pg:dbname=test'):
DBI_USER (or accept default 'metaperl'):
DBI_PASS (or accept default ''):
dbi:Pg:dbname=test at t/limit.t line 46, <STDIN> line 3.
+
t/limit....ok 1/2
+
t/limit....ok 2/2
+
t/limit....ok
All tests successful.
Files=2, Tests=3, 6 wallclock secs ( 0.26 cusr + 0.34 csys = 0.61 C
+PU)
~/hacks/SQL/AnyDBD $
Carter's compass: I know I'm on the right track when by deleting something, I'm adding functionality