commit d7fa89c: [Test] One more fix

Vsevolod Stakhov vsevolod at highsecure.ru
Wed Nov 24 20:49:05 UTC 2021


Author: Vsevolod Stakhov
Date: 2021-11-24 17:55:04 +0000
URL: https://github.com/rspamd/rspamd/commit/d7fa89c8b0e4e51e8cd53aa62304343f20bdbd80

[Test] One more fix

---
 test/lua/rspamd_test_helper.lua | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/test/lua/rspamd_test_helper.lua b/test/lua/rspamd_test_helper.lua
index 4d58d261a..537344831 100644
--- a/test/lua/rspamd_test_helper.lua
+++ b/test/lua/rspamd_test_helper.lua
@@ -6,18 +6,17 @@ void rspamd_url_init (const char *tld_file);
 ]]
 local exports = {}
 
-function exports.init_url_parser(file)
-  if not file then
-    local test_dir = string.gsub(debug.getinfo(1).source, "^@(.+/)[^/]+$", "%1")
-    file = string.format('%s/unit/%s', test_dir, "test_tld.dat")
-  end
+local function default_tld_file()
+  local test_dir = string.gsub(debug.getinfo(1).source, "^@(.+/)[^/]+$", "%1")
+  return string.format('%s/unit/%s', test_dir, "test_tld.dat")
+end
 
-  ffi.C.rspamd_url_init(file)
+function exports.init_url_parser(file)
+  ffi.C.rspamd_url_init(file or default_tld_file())
 end
 
 function exports.default_config()
-  local test_dir = string.gsub(debug.getinfo(1).source, "^@(.+/)[^/]+$", "%1")
-  local tld_file = string.format('%s/%s', test_dir, "test_tld.dat")
+  local tld_file = default_tld_file()
 
   local config = {
     options = {


More information about the Commits mailing list