From 4cd157f07b630284f89a5f99051fe81d2ff3b768 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Mon, 2 Apr 2018 14:58:16 +0100 Subject: [PATCH] [Test] Improve folding tests --- test/lua/unit/folding.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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]+', '') + str = string.gsub(str, '[ ]', '') + str = string.gsub(str, '[\t]', '') + 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) -- 2.39.5