aboutsummaryrefslogtreecommitdiffstats
path: root/test/lua
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-02-28 23:02:27 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-02-28 23:02:27 +0000
commit992ee0e77d502d52593be82d995d91e99afe2c78 (patch)
tree4df4156d66cb6f815287bb557525cfd7730820ab /test/lua
parent79c19905d02ca1bc5802c791b8c7be41fd65e506 (diff)
downloadrspamd-992ee0e77d502d52593be82d995d91e99afe2c78.tar.gz
rspamd-992ee0e77d502d52593be82d995d91e99afe2c78.zip
Add test cases.
Diffstat (limited to 'test/lua')
-rw-r--r--test/lua/unit/redis_stat.lua11
1 files changed, 10 insertions, 1 deletions
diff --git a/test/lua/unit/redis_stat.lua b/test/lua/unit/redis_stat.lua
index 8f772ae75..f994bdf01 100644
--- a/test/lua/unit/redis_stat.lua
+++ b/test/lua/unit/redis_stat.lua
@@ -17,6 +17,8 @@ context("Redis statistics unit tests", function()
struct rspamd_task *task,
char **target);
struct rspamd_task * rspamd_task_new(struct rspamd_worker *worker);
+ int rspamd_task_add_recipient (struct rspamd_task *task, const char *rcpt);
+ int rspamd_task_add_sender (struct rspamd_task *task, const char *sender);
]]
test("Substitute redis values", function()
@@ -24,11 +26,18 @@ context("Redis statistics unit tests", function()
{"%s%l", "symbollabel"},
{"%s%%", "symbol%"},
{"%s%u", "symbol"},
- {"%s%W", "symbolW"}
+ {"%s%W", "symbolW"},
+ {"%r%l", "test@example.comlabel"},
+ {"%f-from", "test@example.com-from"}
}
local stcf = ffi.new("struct rspamd_statfile_config",
{symbol="symbol",label="label"})
local t = ffi.C.rspamd_task_new(nil)
+
+ assert_equal(ffi.C.rspamd_task_add_recipient(t, "Test <test@example.com>"), 1)
+ assert_equal(ffi.C.rspamd_task_add_recipient(t, "Test1 <test1@example.com>"), 1)
+ assert_equal(ffi.C.rspamd_task_add_sender(t, "Test <test@example.com>"), 1)
+
for _,c in ipairs(cases) do
local pbuf = ffi.new 'char *[1]'
local sz = ffi.C.rspamd_redis_expand_object(c[1], stcf, t, pbuf)