]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Fix tests and invocation
authorVsevolod Stakhov <vsevolod@rspamd.com>
Tue, 22 Nov 2022 23:41:33 +0000 (23:41 +0000)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Tue, 22 Nov 2022 23:41:33 +0000 (23:41 +0000)
lualib/lua_selectors/init.lua
test/lua/unit/selectors.lua

index 6dec5ea7fa9a705432f2bfebd86d47b7dc26c0f4..01b43756ad9d636d67628052f49f3f89ff2e7856 100644 (file)
@@ -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
index 4ac2c7bcb042329d6ffb8154cb954b509265298f..c2fe4d7bdc7504d11cad5e54287bc71c5cf24901 100644 (file)
@@ -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