On Fri 22 Oct 2004 23:36, Tim Bunce <[EMAIL PROTECTED]> wrote:
> Added Test::More as a prerequisite module.
Now you're (also) using Test::More, I suggest using it a way that makes
debugging easier once things fail:
You have:
$sth = $dbh->prepare(q{
/* also test preparse doesn't get confused by ? :1 */
/* also test placeholder binding is case insensitive */
select :a, :A from user_tables -- ? :1
});
ok($sth->{ParamValues});
is(keys %{$sth->{ParamValues}}, 1);
is($sth->{NUM_OF_PARAMS}, 1);
ok($sth->bind_param(':a', 'a value'));
ok($sth->execute);
ok($sth->{NUM_OF_FIELDS});
eval {
local $SIG{__WARN__} = sub { die @_ }; # since DBI 1.43
$p1=$sth->{NUM_OFFIELDS_typo};
};
ok($@ =~ /attribute/);
ok($sth->{Active});
ok($sth->finish);
ok(!$sth->{Active});
I have:
# also test preparse doesn't get confused by ? :1
ok ($sth = $dbh->prepare (q{
select * from DIRS -- ? :1
}), "prepare 1");
ok ($sth->execute, "execute");
ok ($sth->{NUM_OF_FIELDS}, "NUM_OF_FIELDS");
eval {
local $SIG{__WARN__} = sub { die @_ }; # since DBI 1.43
my $x = $sth->{NUM_OFFIELDS_typo};
};
like ($@, qr/attribute/, "attr typo");
ok ($sth->{Active}, "Active");
ok ($sth->finish, "finish");
ok (!$sth->{Active}, "not Active");
undef $sth; # Force destroy
ok ($sth = $dbh->prepare ("select * from DIRS"), "prepare 2");
ok ($sth->execute, "execute 2");
ok ($sth->{Active}, "Active 2");
1 while ($sth->fetch); # fetch through to end
ok (!$sth->{Active}, "auto finish");
undef $sth;
Note that all tests have a comment that will be printed out if run seperate
(not from harness), and the use of like (....) after the eval.
lep a5:/pro/3gl/CPAN/DBD-Unify-0.41 108 > make test
/pro/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib',
'blib/arch')" t/*.t
t/01-base.........ok
t/02-connect......ok
t/03-general......ok
t/04-long.........skipped
all skipped: DBD::Unify does not (yet) support binary/text
t/05-reauth.......skipped
all skipped: No tests here yet. Please investigate
t/10-dbi-drv......ok
t/11-dbi-dbh......ok
2/21 unexpectedly succeeded
t/12-dbi-sth......ok
t/20-uni-basic....ok
t/21-uni-regex....ok
t/27-uni-max......To disable future max tests: setenv DBD_UNIFY_SKIP_27 1
t/27-uni-max......ok
t/30-reconnect....ok
t/40-info.........ok
t/99-done.........ok
All tests successful (2 subtests UNEXPECTEDLY SUCCEEDED), 2 tests skipped.
Files=14, Tests=2692, 15 wallclock secs (10.97 cusr + 0.79 csys = 11.76 CPU)
lep a5:/pro/3gl/CPAN/DBD-Unify-0.41 109 > perl -Iblib/{lib,arch} t/03-general.t
1..16
ok 1 - use DBI;
ok 2 - Connect
ok 3 - prepare 1
ok 4 - execute
ok 5 - NUM_OF_FIELDS
ok 6 - attr typo
ok 7 - Active
ok 8 - finish
ok 9 - not Active
ok 10 - prepare 2
ok 11 - execute 2
ok 12 - Active 2
ok 13 - auto finish
ok 14 - expected 'do failed:'
ok 15 - ping
ok 16 - !ping
lep a5:/pro/3gl/CPAN/DBD-Unify-0.41 110 >
I'm hoping to bring out DBD-Unify-0.41 asap with more DBI-1.45 support
--
H.Merijn Brand Amsterdam Perl Mongers (http://amsterdam.pm.org/)
using perl-5.6.1, 5.8.0 & 633 on HP-UX 10.20 & 11.00, AIX 4.2, AIX 4.3,
WinNT 4, Win2K pro & WinCE 2.11 often with Tk800.024 &/| DBD-Unify
ftp://ftp.funet.fi/pub/languages/perl/CPAN/authors/id/H/HM/HMBRAND/