commit 5858739: [Minor] Fix tests and invocation

Vsevolod Stakhov vsevolod at rspamd.com
Tue Nov 22 23:56:04 UTC 2022


Author: Vsevolod Stakhov
Date: 2022-11-22 23:41:33 +0000
URL: https://github.com/rspamd/rspamd/commit/5858739fec90975fb2067374b06999dc8344597d

[Minor] Fix tests and invocation

---
 lualib/lua_selectors/init.lua | 2 +-
 test/lua/unit/selectors.lua   | 5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/lualib/lua_selectors/init.lua b/lualib/lua_selectors/init.lua
index 6dec5ea7f..01b43756a 100644
--- a/lualib/lua_selectors/init.lua
+++ b/lualib/lua_selectors/init.lua
@@ -580,7 +580,7 @@ exports.create_selector_closure_fn = function(log_obj, cfg, selector_str, delimi
     local res = exports.process_selectors(task, selector)
 
     if res then
-      fn(log_obj, res, delimiter)
+      return fn(log_obj, res, delimiter)
     end
 
     return nil
diff --git a/test/lua/unit/selectors.lua b/test/lua/unit/selectors.lua
index 4ac2c7bcb..c2fe4d7bd 100644
--- a/test/lua/unit/selectors.lua
+++ b/test/lua/unit/selectors.lua
@@ -35,8 +35,9 @@ context("Selectors test", function()
   end)
 
   local function check_selector(selector_string)
-    local sels = lua_selectors.parse_selector(cfg, selector_string)
-    local elts = lua_selectors.process_selectors(task, sels)
+    local sels = lua_selectors.create_selector_closure_fn(nil, cfg, selector_string, nil,
+        function(_, res, _) return res end)
+    local elts = sels(task)
     return elts
   end
 


More information about the Commits mailing list