aboutsummaryrefslogtreecommitdiffstats
path: root/test/lua/rspamd_test_helper.lua
diff options
context:
space:
mode:
Diffstat (limited to 'test/lua/rspamd_test_helper.lua')
-rw-r--r--test/lua/rspamd_test_helper.lua15
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 = {