diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-10 21:30:40 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-10 21:30:40 +0000 |
commit | 133a45c109da5310add55824db21af5239951f93 (patch) | |
tree | ba6ac4c0a950a0dda56451944315d66409923918 /test/functional/lua/deps.lua | |
parent | Initial commit. (diff) | |
download | rspamd-133a45c109da5310add55824db21af5239951f93.tar.xz rspamd-133a45c109da5310add55824db21af5239951f93.zip |
Adding upstream version 3.8.1.upstream/3.8.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | test/functional/lua/deps.lua | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/test/functional/lua/deps.lua b/test/functional/lua/deps.lua new file mode 100644 index 0000000..6171db6 --- /dev/null +++ b/test/functional/lua/deps.lua @@ -0,0 +1,30 @@ +local cb = function(task) + task:insert_result('TOP', 1.0) +end + +local cb_dep1 = function(task) + if task:get_symbol('TOP') then + task:insert_result('DEP1', 1.0) + end +end + +local cb_gen = function(num) + local cb_dep = function(task) + if task:get_symbol('DEP' .. tostring(num)) then + task:insert_result('DEP' .. tostring(num + 1), 1.0) + end + end + + return cb_dep +end + +local id = rspamd_config:register_callback_symbol(1.0, cb) +rspamd_config:register_virtual_symbol('TOP', 1.0, id) + +rspamd_config:register_symbol('DEP1', 1.0, cb_dep1) +rspamd_config:register_dependency('DEP1', 'TOP') + +for i = 2,10 do + rspamd_config:register_symbol('DEP' .. tostring(i), 1.0, cb_gen(i - 1)) + rspamd_config:register_dependency('DEP' .. tostring(i), 'DEP' .. tostring(i - 1)) +end |