You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.6 KiB
49 lines
1.6 KiB
3 months ago
|
From 2eda0ec996d0a9357885acd442c72ac206adb7b3 Mon Sep 17 00:00:00 2001
|
||
|
From: "H.Merijn Brand - Tux" <linux@tux.freedom.nl>
|
||
|
Date: Wed, 28 Oct 2020 15:09:01 +0100
|
||
|
Subject: [PATCH] Catch warning
|
||
|
|
||
|
---
|
||
|
t/51dbm_file.t | 16 ++++++++++------
|
||
|
1 file changed, 10 insertions(+), 6 deletions(-)
|
||
|
|
||
|
diff --git a/t/51dbm_file.t b/t/51dbm_file.t
|
||
|
index 686a3d2..0ae910c 100644
|
||
|
--- a/t/51dbm_file.t
|
||
|
+++ b/t/51dbm_file.t
|
||
|
@@ -18,21 +18,25 @@ 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");
|
||
|
+ my $dbh = eval {
|
||
|
+ local $SIG{__WARN__} = sub { push @msg, @_ };
|
||
|
+ local $SIG{__DIE__} = sub { push @msg, @_ };
|
||
|
+ DBI->connect ("dbi:DBM:f_dir=./hopefully-doesnt-existst;sql_identifier_case=1;RaiseError=1");
|
||
|
};
|
||
|
+ is ($dbh, undef, "Connect failed");
|
||
|
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, {
|
||
|
+ $dbh = eval {
|
||
|
+ local $SIG{__WARN__} = sub { push @msg, @_ };
|
||
|
+ local $SIG{__DIE__} = sub { push @msg, @_ };
|
||
|
+ DBI->connect ("dbi:DBM:", , undef, undef, {
|
||
|
f_dir => "./hopefully-doesnt-existst",
|
||
|
sql_identifier_case => 1,
|
||
|
RaiseError => 1,
|
||
|
});
|
||
|
};
|
||
|
+ is ($dbh, undef, "Connect failed");
|
||
|
like ("@msg", qr{.*hopefully-doesnt-existst}, "Cannot open from non-existing directory with attributes in HASH");
|
||
|
}
|
||
|
|
||
|
--
|
||
|
2.41.0
|
||
|
|