diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-03-09 12:11:11 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-03-09 12:11:11 +0000 |
commit | 89a670472d1208a5c9d92d5e2259cec18da0f723 (patch) | |
tree | 5fe240fc99a802570b2817065e8afb548defbdfd /test/lua/rspamd_assertions.lua | |
parent | d1aa388f92e78f61207cf68e12b17689867cf801 (diff) | |
download | rspamd-89a670472d1208a5c9d92d5e2259cec18da0f723.tar.gz rspamd-89a670472d1208a5c9d92d5e2259cec18da0f723.zip |
[Test] Sort hash tables in tests
Diffstat (limited to 'test/lua/rspamd_assertions.lua')
-rw-r--r-- | test/lua/rspamd_assertions.lua | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/test/lua/rspamd_assertions.lua b/test/lua/rspamd_assertions.lua index da01356ac..ac68cfc0a 100644 --- a/test/lua/rspamd_assertions.lua +++ b/test/lua/rspamd_assertions.lua @@ -17,6 +17,10 @@ local function rspamd_assert_table_equals(tbl) return util.table_cmp(tbl.expect, tbl.actual) end +local function rspamd_assert_table_equals_sorted(tbl) + return util.table_cmp(table.sort(tbl.expect), table.sort(tbl.actual)) +end + local function table_keys_sorted(t) local keys = {} @@ -123,3 +127,6 @@ end telescope.make_assertion("rspamd_eq", rspamd_assert_equals_msg, rspamd_assert_equals) -- telescope.make_assertion("rspamd_table_eq", rspamd_assert_equals_msg, rspamd_assert_table_equals) telescope.make_assertion("rspamd_table_eq", rspamd_assert_table_diff_msg, rspamd_assert_table_equals) +telescope.make_assertion("rspamd_table_eq_sorted", rspamd_assert_table_diff_msg, + rspamd_assert_table_equals_sorted) + |