From: Vsevolod Stakhov Date: Thu, 16 Jun 2016 11:07:08 +0000 (+0100) Subject: [Minor] Add some more tests X-Git-Tag: 1.3.0~324 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=e4f16f2eaa5b32eef75076e86a3ccf0d79b3aa08;p=rspamd.git [Minor] Add some more tests --- diff --git a/test/lua/unit/expressions.lua b/test/lua/unit/expressions.lua index f2c4014b5..1e5d09cb5 100644 --- a/test/lua/unit/expressions.lua +++ b/test/lua/unit/expressions.lua @@ -93,7 +93,9 @@ context("Rspamd expressions", function() {'F && ((A + B + C + D) > 1)', 0}, {'(E) && ((B + B + B + B) >= 1)', 0}, {'!!C', 1}, - {'(B) & (D) & ((G) | (H) | (I) | (A))', 0} + {'(B) & (D) & ((G) | (H) | (I) | (A))', 0}, + {'A & C & (!D || !C || !E)', 1}, + {'A & C & !(D || C || E)', 0}, } for _,c in ipairs(cases) do local expr,err = rspamd_expression.create(c[1], @@ -102,8 +104,8 @@ context("Rspamd expressions", function() assert_not_nil(expr, "Cannot parse " .. c[1]) --print(expr) res = expr:process(atoms) - assert_equal(res, c[2], string.format("Processed expr '%s' returned '%d', expected: '%d'", - expr:to_string(), res, c[2])) + assert_equal(res, c[2], string.format("Processed expr '%s'{%s} returned '%d', expected: '%d'", + expr:to_string(), c[1], res, c[2])) end pool:destroy()