commit f2f389b: [Test] Add unit test for get_tld transform + sort test cases

Vsevolod Stakhov vsevolod at highsecure.ru
Sun Sep 13 22:56:10 UTC 2020


Author: Vsevolod Stakhov
Date: 2020-09-13 23:53:38 +0100
URL: https://github.com/rspamd/rspamd/commit/f2f389b273f1f92dd79b2250dc941a3a6bb1b0c0 (HEAD -> master)

[Test] Add unit test for get_tld transform + sort test cases

---
 test/lua/unit/selectors.lua | 8 ++++++--
 1 file 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)


More information about the Commits mailing list