mirror of
https://github.com/DBD-SQLite/DBD-SQLite
synced 2025-06-07 14:19:10 -04:00
make sure errors were actually raised
This commit is contained in:
parent
3d62ea8a29
commit
2059f6f2ae
1 changed files with 5 additions and 1 deletions
|
@ -7,7 +7,7 @@ BEGIN {
|
|||
}
|
||||
|
||||
use t::lib::Test qw/connect_ok/;
|
||||
use Test::More tests => 32;
|
||||
use Test::More tests => 38;
|
||||
use DBI qw/:sql_types/;
|
||||
|
||||
my $id = 0;
|
||||
|
@ -38,6 +38,7 @@ for my $has_pk (0..1) {
|
|||
my $ret = eval { $sth->execute };
|
||||
|
||||
if ($has_pk) {
|
||||
ok $@, "died correctly";
|
||||
ok !defined $ret, "returns undef";
|
||||
ok $sth->errstr && $sth->errstr =~ /datatype mismatch/, "insert failed: type mismatch";
|
||||
}
|
||||
|
@ -62,6 +63,7 @@ for my $has_pk (0..1) {
|
|||
my $ret = eval { $sth->execute };
|
||||
|
||||
if ($has_pk) {
|
||||
ok $@, "died correctly";
|
||||
ok !defined $ret, "returns undef";
|
||||
ok $sth->errstr && $sth->errstr =~ /datatype mismatch/, "insert failed: type mismatch";
|
||||
}
|
||||
|
@ -95,6 +97,7 @@ for my $has_pk (0..1) {
|
|||
$sth->bind_param(1, ++$id);
|
||||
$sth->bind_param(2, 3.5, SQL_INTEGER);
|
||||
my $ret = eval { $sth->execute };
|
||||
ok $@, "died correctly";
|
||||
ok !defined $ret, "returns undef";
|
||||
ok $sth->errstr && $sth->errstr =~ /datatype mismatch/, "insert failed: type mismatch";
|
||||
|
||||
|
@ -109,6 +112,7 @@ for my $has_pk (0..1) {
|
|||
|
||||
# only dies if type is explicitly specified
|
||||
my $ret = eval { $sth->execute };
|
||||
ok $@, "died correctly";
|
||||
ok !defined $ret, "returns undef";
|
||||
ok $sth->errstr && $sth->errstr =~ /datatype mismatch/, "insert failed: type mismatch";
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue