diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-04-02 14:58:16 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-04-02 14:58:16 +0100 |
commit | 4cd157f07b630284f89a5f99051fe81d2ff3b768 (patch) | |
tree | c14b924122bba57a8f1302c62dbf05da68b40404 /test/lua | |
parent | 4f76fe912e3980ffc7684fff3818490649401188 (diff) | |
download | rspamd-4cd157f07b630284f89a5f99051fe81d2ff3b768.tar.gz rspamd-4cd157f07b630284f89a5f99051fe81d2ff3b768.zip |
[Test] Improve folding tests
Diffstat (limited to 'test/lua')
-rw-r--r-- | test/lua/unit/folding.lua | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/test/lua/unit/folding.lua b/test/lua/unit/folding.lua index b4904f797..3721a05f0 100644 --- a/test/lua/unit/folding.lua +++ b/test/lua/unit/folding.lua @@ -48,13 +48,19 @@ context("Headers folding unit test", function() "Returnpath_BL2,HFILTER_FROM_BOUNCE,R_PARTS_DIFFER,\r\n\tR_IP_PBL,R_ONE_RCPT,R_googleredir,R_TO_SEEMS_AUTO,R_SPF_NEUTRAL,R_PRIORITY_3,\r\n\tRBL_SPAMHAUS_PBL,HFILTER_MID_NOT_FQDN,MISSING_CTE,R_HAS_URL,RBL_SPAMHAUS_CSS,\r\n\tRBL_SPAMHAUS_XBL,BAYES_SPAM,RECEIVED_RBL10" }, } + local function escape_spaces(str) + str = string.gsub(str, '[\r\n]+', '<NL>') + str = string.gsub(str, '[ ]', '<SP>') + str = string.gsub(str, '[\t]', '<TB>') + return str + end for i,c in ipairs(cases) do test("Headers folding: " .. i, function() local fv = util.fold_header(c[1][1], c[1][2], 'crlf', ';') assert_not_nil(fv) assert_equal(fv, c[2], string.format("'%s' doesn't match with '%s'", - c[2], fv)) + escape_spaces(c[2]), escape_spaces(fv))) end) end end) |