aboutsummaryrefslogtreecommitdiffstats
path: root/test/lua
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-03-17 22:22:04 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-03-17 23:29:49 +0000
commita6e30390f384a5dd6446542436d45fd983af565b (patch)
treeae20caf772cdc74ea36508df55b000690a7daa14 /test/lua
parentcc544380dd8034bdedbb51211a96cd6119546f7d (diff)
downloadrspamd-a6e30390f384a5dd6446542436d45fd983af565b.tar.gz
rspamd-a6e30390f384a5dd6446542436d45fd983af565b.zip
Fix expressions unit test.
Diffstat (limited to 'test/lua')
-rw-r--r--test/lua/unit/expressions.lua7
1 files changed, 4 insertions, 3 deletions
diff --git a/test/lua/unit/expressions.lua b/test/lua/unit/expressions.lua
index dc9cfd0cb..4c6c55f7d 100644
--- a/test/lua/unit/expressions.lua
+++ b/test/lua/unit/expressions.lua
@@ -3,11 +3,12 @@
context("Rspamd expressions", function()
local rspamd_expression = require "rspamd_expression"
local rspamd_mempool = require "rspamd_mempool"
- local _ = require "fun"
+ local rspamd_regexp = require "rspamd_regexp"
+ local split_re = rspamd_regexp.create('/\\s+/')
local function parse_func(str)
-- extract token till the first space character
- local token = table.join('', take_while(function(s) return s ~= ' ' end, str))
+ local token = split_re:split(str)[1]
-- Return token name
return token
end
@@ -27,7 +28,7 @@ context("Rspamd expressions", function()
{parse_func, process_func}, pool)
if c[2] then
- assert_not_null(expr, "Cannot parse " .. c[1] ": " .. err)
+ assert_not_nil(expr, "Cannot parse " .. c[1] ": " .. err)
else
assert_equal(expr:to_string(), c[2], string.format("Evaluated expr to '%s', expected: '%s'",
expr:to_string(), c[2]))