aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2020-09-13 23:53:38 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2020-09-13 23:53:38 +0100
commitf2f389b273f1f92dd79b2250dc941a3a6bb1b0c0 (patch)
tree57866a7ed556b0da94d5a0ebad362ba62415db79 /test
parent41abce28637af1df5a4d28b0d97490bead0c3b92 (diff)
downloadrspamd-f2f389b273f1f92dd79b2250dc941a3a6bb1b0c0.tar.gz
rspamd-f2f389b273f1f92dd79b2250dc941a3a6bb1b0c0.zip
[Test] Add unit test for get_tld transform + sort test cases
Diffstat (limited to 'test')
-rw-r--r--test/lua/unit/selectors.lua8
1 files changed, 6 insertions, 2 deletions
diff --git a/test/lua/unit/selectors.lua b/test/lua/unit/selectors.lua
index e65b046c2..3367a6df8 100644
--- a/test/lua/unit/selectors.lua
+++ b/test/lua/unit/selectors.lua
@@ -5,6 +5,7 @@ context("Selectors test", function()
local lua_selectors = require "lua_selectors"
local lua_maps = require "lua_maps"
local test_helper = require "rspamd_test_helper"
+ local lua_util = require "lua_util"
local cfg = rspamd_config
local task
@@ -226,9 +227,12 @@ context("Selectors test", function()
selector = "urls:get_host",
expect = {{"subdomain.example.net"}}},
- ["get_tld"] = {
+ ["get_tld_method"] = {
selector = "urls:get_tld",
expect = {{"example.net"}}},
+ ["get_tld_transform"] = {
+ selector = "urls:get_host.get_tld",
+ expect = {{"example.net"}}},
["transformation regexp"] = {
selector = "urls:get_tld.regexp('\\.([\\w]+)$')",
@@ -356,7 +360,7 @@ context("Selectors test", function()
},
}
- for case_name, case in pairs(cases) do
+ for case_name, case in lua_util.spairs(cases) do
test("case " .. case_name, function()
local elts = check_selector(case.selector)
assert_not_nil(elts)