Skip to content

Commit

Permalink
t/51dbm_file.t: add test from RT#99508
Browse files Browse the repository at this point in the history
Add test with f_dir="something-not-existing" as reported in RT#99508
to verify when it's fixed for real.

Signed-off-by: Jens Rehsack <sno@netbsd.org>
  • Loading branch information
rehsack committed Oct 6, 2020
1 parent 32398bf commit 27b10b5
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions t/51dbm_file.t
Expand Up @@ -15,6 +15,27 @@ use DBI;

do "./t/lib.pl";

{
# test issue reported in RT#99508
my @msg;
eval {
local $SIG{__DIE__} = sub { push @msg, @_ };
my $dbh = DBI->connect ("dbi:DBM:f_dir=./hopefully-doesnt-existst;sql_identifier_case=1;RaiseError=1");
};
like ("@msg", qr{.*hopefully-doesnt-existst.*}, "Cannot open from non-existing directory with attributes in DSN");

@msg = ();
eval {
local $SIG{__DIE__} = sub { push @msg, @_ };
my $dbh = DBI->connect ("dbi:DBM:", , undef, undef, {
f_dir => "./hopefully-doesnt-existst",
sql_identifier_case => 1,
RaiseError => 1,
});
};
like ("@msg", qr{.*hopefully-doesnt-existst}, "Cannot open from non-existing directory with attributes in HASH");
}

my $dir = test_dir();

my $dbh = DBI->connect( 'dbi:DBM:', undef, undef, {
Expand All @@ -23,6 +44,8 @@ my $dbh = DBI->connect( 'dbi:DBM:', undef, undef, {
}
);

ok( $dbh, "Connect with driver attributes in hash" );

ok( $dbh->do(q/drop table if exists FRED/), 'drop table' );

my $dirfext = $^O eq 'VMS' ? '.sdbm_dir' : '.dir';
Expand Down

0 comments on commit 27b10b5

Please sign in to comment.