]> source.dussan.org Git - rspamd.git/commitdiff
[Test] Added test helper module
authorMikhail Galanin <mgalanin@mimecast.com>
Fri, 21 Sep 2018 08:54:51 +0000 (09:54 +0100)
committerMikhail Galanin <mgalanin@mimecast.com>
Fri, 21 Sep 2018 08:54:51 +0000 (09:54 +0100)
test/lua/rspamd_test_helper.lua [new file with mode: 0644]

diff --git a/test/lua/rspamd_test_helper.lua b/test/lua/rspamd_test_helper.lua
new file mode 100644 (file)
index 0000000..80ca2c8
--- /dev/null
@@ -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