aboutsummaryrefslogtreecommitdiffstats
path: root/test/lua/unit
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-05-13 17:41:50 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-05-13 17:41:50 +0100
commit2e14aa473ea20b485ed18f71c6ede2099c7b23cb (patch)
treea409f28a03b9d4011bacfc722a59c1926ac9f490 /test/lua/unit
parent6d40820bdeef5882dc91f7c7979f01a4cc94b824 (diff)
downloadrspamd-2e14aa473ea20b485ed18f71c6ede2099c7b23cb.tar.gz
rspamd-2e14aa473ea20b485ed18f71c6ede2099c7b23cb.zip
Fix regexp splitting in lua.
Diffstat (limited to 'test/lua/unit')
-rw-r--r--test/lua/unit/regxep.lua8
1 files changed, 5 insertions, 3 deletions
diff --git a/test/lua/unit/regxep.lua b/test/lua/unit/regxep.lua
index 8cc2db2bd..3aca6c7ba 100644
--- a/test/lua/unit/regxep.lua
+++ b/test/lua/unit/regxep.lua
@@ -34,10 +34,12 @@ context("Regexp unit tests", function()
test("Regexp split", function()
local cases = {
+ {'\\s', 'one', {'one'}}, -- one arg
{'\\s', 'one two', {'one', 'two'}}, -- trivial
+ {'/,/i', '1,2', {'1', '2'}}, -- trivial
{'\\s', 'one two', {'one', 'two'}}, -- multiple delimiters
{'\\s', ' one two ', {'one', 'two'}}, -- multiple delimiters
- {'\\s', ' one ', {'one', 'two'}}, -- multiple delimiters
+ {'\\s', ' one ', {'one'}}, -- multiple delimiters
{'[:,]', ',,,:::one,two,,', {'one', 'two'}}, -- multiple delimiters
}
@@ -48,8 +50,8 @@ context("Regexp unit tests", function()
local res = r:split(c[2])
assert_not_nil(res, "cannot split " .. c[2])
- for i,r in ipairs(res) do
- assert_equal(r, c[3][i])
+ for i,r in ipairs(c[3]) do
+ assert_equal(res[i], r)
end
end
end)