diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-12-09 15:25:11 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-09 15:25:11 +0000 |
commit | abc43462c390b761d2673863d5e14571f5e90dd0 (patch) | |
tree | 776f22aa925f297e3fe7eebae485521a574c2188 /test | |
parent | 076afbad6335b2e6bd643cc453bf3c2437edbe60 (diff) | |
parent | 838d9dda1a443493d6348b7ce1245717d654e839 (diff) | |
download | rspamd-abc43462c390b761d2673863d5e14571f5e90dd0.tar.gz rspamd-abc43462c390b761d2673863d5e14571f5e90dd0.zip |
Merge pull request #3574 from fatalbanana/selectors_cache
[Minor] Selectors: support extracting task cache variables
Diffstat (limited to 'test')
-rw-r--r-- | test/lua/unit/selectors.lua | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/lua/unit/selectors.lua b/test/lua/unit/selectors.lua index 1f7252a77..270d06941 100644 --- a/test/lua/unit/selectors.lua +++ b/test/lua/unit/selectors.lua @@ -27,6 +27,8 @@ context("Selectors test", function() task:process_message() task:get_mempool():set_variable("int_var", 1) task:get_mempool():set_variable("str_var", "str 1") + task:cache_set('cachevar1', 'hello\x00world') + task:cache_set('cachevar2', {'hello', 'world'}) if not res then assert_true(false, "failed to load message") end @@ -358,6 +360,15 @@ context("Selectors test", function() selector = "header('Subject').regexp('.*').first", expect = {"Second, lower-cased header subject"} }, + + ["task cache string"] = { + selector = "task_cache('cachevar1')", + expect = {"hello\x00world"} + }, + ["task cache table"] = { + selector = "task_cache('cachevar2')", + expect = {{"hello", "world"}} + }, } for case_name, case in lua_util.spairs(cases) do |