aboutsummaryrefslogtreecommitdiffstats
path: root/test/lua/unit/expressions.lua
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-03-18 10:54:42 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-03-18 10:54:42 +0000
commit0fb9135156411d047679ca35982edee5b8cc16d8 (patch)
tree658537ca25d52e544b393fa3e0b1a59542d679ec /test/lua/unit/expressions.lua
parent2f6828223acfd6e12f4951e9af9b77d72d7655e9 (diff)
downloadrspamd-0fb9135156411d047679ca35982edee5b8cc16d8.tar.gz
rspamd-0fb9135156411d047679ca35982edee5b8cc16d8.zip
Add more unit tests.
Diffstat (limited to 'test/lua/unit/expressions.lua')
-rw-r--r--test/lua/unit/expressions.lua12
1 files changed, 11 insertions, 1 deletions
diff --git a/test/lua/unit/expressions.lua b/test/lua/unit/expressions.lua
index f191019e6..69a141f46 100644
--- a/test/lua/unit/expressions.lua
+++ b/test/lua/unit/expressions.lua
@@ -26,7 +26,17 @@ context("Rspamd expressions", function()
local cases = {
{'A & B | !C', 'A B & C ! |'},
- {'A & (B | !C)', 'A B C ! | &'}
+ {'A & (B | !C)', 'A B C ! | &'},
+ -- Unbalanced braces
+ {'(((A))', nil},
+ -- Balanced braces
+ {'(((A)))', 'A'},
+ -- Plus and comparision operators
+ {'A + B + C + D > 2', 'A B C D + + + 2 >'},
+ -- Plus and logic operators
+ {'((A + B + C + D) > 2) & D', 'A B C D + + + 2 > D &'},
+ -- Associativity
+ {'A | B | C & D & E', 'A B C D E & & | |'},
}
for _,c in ipairs(cases) do
local expr,err = rspamd_expression.create(c[1],