diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2021-11-24 17:55:04 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2021-11-24 17:55:04 +0000 |
commit | d7fa89c8b0e4e51e8cd53aa62304343f20bdbd80 (patch) | |
tree | 7492ab315f4c371d7f8bcce5798799456c2ee9e9 /test/lua | |
parent | b1c611505e3e0bac95570fd76dcfaad21814f319 (diff) | |
download | rspamd-d7fa89c8b0e4e51e8cd53aa62304343f20bdbd80.tar.gz rspamd-d7fa89c8b0e4e51e8cd53aa62304343f20bdbd80.zip |
[Test] One more fix
Diffstat (limited to 'test/lua')
-rw-r--r-- | test/lua/rspamd_test_helper.lua | 15 |
1 files 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 = { |