From 0b0cad929f07ac90b065678be21af15da0e065f8 Mon Sep 17 00:00:00 2001 From: Mikhail Galanin Date: Fri, 21 Sep 2018 09:54:51 +0100 Subject: [PATCH] [Test] Added test helper module --- test/lua/rspamd_test_helper.lua | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 test/lua/rspamd_test_helper.lua diff --git a/test/lua/rspamd_test_helper.lua b/test/lua/rspamd_test_helper.lua new file mode 100644 index 000000000..80ca2c8f7 --- /dev/null +++ b/test/lua/rspamd_test_helper.lua @@ -0,0 +1,18 @@ +local ffi = require "ffi" +local cfg = rspamd_config + +ffi.cdef[[ +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 + + ffi.C.rspamd_url_init(file) +end + +return exports \ No newline at end of file -- 2.39.5