From: Mikhail Galanin Date: Fri, 21 Sep 2018 08:56:11 +0000 (+0100) Subject: [Test] Use init_url() frim the new helper X-Git-Tag: 1.8.0~46^2~1 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=90c979e64ea862c3a2c3e14aefe5a49c893d65cd;p=rspamd.git [Test] Use init_url() frim the new helper --- diff --git a/test/lua/unit/lua_util.extract_specific_urls.lua b/test/lua/unit/lua_util.extract_specific_urls.lua index 1eaa88187..210e0370c 100644 --- a/test/lua/unit/lua_util.extract_specific_urls.lua +++ b/test/lua/unit/lua_util.extract_specific_urls.lua @@ -4,19 +4,11 @@ context("Lua util - extract_specific_urls", function() local fun = require "fun" local url = require "rspamd_url" local logger = require "rspamd_logger" - local ffi = require "ffi" local rspamd_util = require "rspamd_util" local rspamd_task = require "rspamd_task" + local test_helper = require "rspamd_test_helper" - ffi.cdef[[ - void rspamd_url_init (const char *tld_file); - unsigned ottery_rand_range(unsigned top); - void rspamd_http_normalize_path_inplace(char *path, size_t len, size_t *nlen); - ]] - - local test_dir = string.gsub(debug.getinfo(1).source, "^@(.+/)[^/]+$", "%1") - - ffi.C.rspamd_url_init(string.format('%s/%s', test_dir, "test_tld.dat")) + test_helper.init_url_parser() local task_object = { urls = {}, diff --git a/test/lua/unit/selectors.lua b/test/lua/unit/selectors.lua index 5454f35d4..9b3f950ea 100644 --- a/test/lua/unit/selectors.lua +++ b/test/lua/unit/selectors.lua @@ -3,20 +3,11 @@ context("Selectors test", function() local rspamd_task = require "rspamd_task" local logger = require "rspamd_logger" local lua_selectors = require "lua_selectors" - local ffi = require "ffi" + local test_helper = require "rspamd_test_helper" local cfg = rspamd_config - local task - - ffi.cdef[[ - void rspamd_url_init (const char *tld_file); - unsigned ottery_rand_range(unsigned top); - void rspamd_http_normalize_path_inplace(char *path, size_t len, size_t *nlen); - ]] - local test_dir = string.gsub(debug.getinfo(1).source, "^@(.+/)[^/]+$", "%1") - - ffi.C.rspamd_url_init(string.format('%s/%s', test_dir, "test_tld.dat")) + test_helper.init_url_parser() before(function() local res diff --git a/test/lua/unit/url.lua b/test/lua/unit/url.lua index 902744c2e..a748c4de8 100644 --- a/test/lua/unit/url.lua +++ b/test/lua/unit/url.lua @@ -4,16 +4,14 @@ context("URL check functions", function() local mpool = require("rspamd_mempool") local url = require("rspamd_url") local logger = require("rspamd_logger") + local test_helper = require("rspamd_test_helper") local ffi = require("ffi") + ffi.cdef[[ - void rspamd_url_init (const char *tld_file); - unsigned ottery_rand_range(unsigned top); void rspamd_http_normalize_path_inplace(char *path, size_t len, size_t *nlen); ]] - local test_dir = string.gsub(debug.getinfo(1).source, "^@(.+/)[^/]+$", "%1") - - ffi.C.rspamd_url_init(string.format('%s/%s', test_dir, "test_tld.dat")) + test_helper.init_url_parser() local pool = mpool.create()