From: Mikhail Galanin Date: Fri, 21 Sep 2018 08:56:49 +0000 (+0100) Subject: [Test] Small fixes on diff renderer X-Git-Tag: 1.8.0~46^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=da4067b0dc30bc6b72e19122c57829b84a00bb94;p=rspamd.git [Test] Small fixes on diff renderer --- diff --git a/test/lua/rspamd_assertions.lua b/test/lua/rspamd_assertions.lua index cebd13c54..728f8b9a6 100644 --- a/test/lua/rspamd_assertions.lua +++ b/test/lua/rspamd_assertions.lua @@ -77,6 +77,7 @@ local function rspamd_assert_table_diff_msg(_, tbl) local v_actual = actual[i_v_actual] if i_v_expect == i_v_actual then + -- table keys are the same: compare values if type(v_expect) == 'table' and type(v_actual) == 'table' then if util.table_cmp(v_expect, v_actual) then -- we use the same value for 'actual' and 'expect' as soon as they're equal and don't bother us @@ -86,15 +87,13 @@ local function rspamd_assert_table_diff_msg(_, tbl) recurse(v_expect, v_actual, level + 1) diff[#diff + 1] = format_table_end(level) end - elseif v_expect ~= v_actual then - diff[#diff + 1] = format_line(level, i_v_expect, v_expect, v_actual) else diff[#diff + 1] = format_line(level, i_v_expect, v_expect, v_actual) end i_k_expect, i_v_expect = next(keys_expect, i_k_expect) i_k_actual, i_v_actual = next(keys_actual, i_k_actual) - elseif tostring(v_actual) > tostring(i_v_actual) then + elseif tostring(v_actual) > tostring(v_expect) then diff[#diff + 1] = format_line(level, i_v_expect, v_expect, nil) i_k_expect, i_v_expect = next(keys_expect, i_k_expect) else