diff options
author | Mikhail Galanin <mgalanin@mimecast.com> | 2018-09-21 09:54:51 +0100 |
---|---|---|
committer | Mikhail Galanin <mgalanin@mimecast.com> | 2018-09-21 09:54:51 +0100 |
commit | 0b0cad929f07ac90b065678be21af15da0e065f8 (patch) | |
tree | bfd56d4ffa95950d66b6b636d294269fdebf6936 /test/lua/rspamd_test_helper.lua | |
parent | 094548aeed552bc3b07fd68d9d5f934da120c399 (diff) | |
download | rspamd-0b0cad929f07ac90b065678be21af15da0e065f8.tar.gz rspamd-0b0cad929f07ac90b065678be21af15da0e065f8.zip |
[Test] Added test helper module
Diffstat (limited to 'test/lua/rspamd_test_helper.lua')
-rw-r--r-- | test/lua/rspamd_test_helper.lua | 18 |
1 files changed, 18 insertions, 0 deletions
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 |