diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-07-06 11:50:53 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-07-06 11:50:53 +0100 |
commit | 8b74a6dd2e8bb5ae4651b0b42369be86f21383ae (patch) | |
tree | 0a4b2a19ee82eb636c4e50fc9472c86450b28840 /test | |
parent | 427a332e24279beafaa410545f747154437afa4d (diff) | |
download | rspamd-8b74a6dd2e8bb5ae4651b0b42369be86f21383ae.tar.gz rspamd-8b74a6dd2e8bb5ae4651b0b42369be86f21383ae.zip |
[Minor] Test: Sort tables when asserting
Diffstat (limited to 'test')
-rw-r--r-- | test/lua/unit/lua_util.extract_specific_urls.lua | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/test/lua/unit/lua_util.extract_specific_urls.lua b/test/lua/unit/lua_util.extract_specific_urls.lua index 8e225b8fa..71c83e35c 100644 --- a/test/lua/unit/lua_util.extract_specific_urls.lua +++ b/test/lua/unit/lua_util.extract_specific_urls.lua @@ -161,9 +161,7 @@ context("Lua util - extract_specific_urls plain", function() local s = logger.slog("%1 =?= %2", c.expect, actual_result) print(s) --]] - table.sort(actual_result) - table.sort(c.expect) - assert_rspamd_table_eq({actual = actual_result, expect = c.expect}) + assert_rspamd_table_eq_sorted({actual = actual_result, expect = c.expect}) end) test("extract_specific_urls " .. i, function() @@ -184,9 +182,7 @@ context("Lua util - extract_specific_urls plain", function() local s = logger.slog("case[%1] %2 =?= %3", i, c.expect, actual_result) print(s) --]] - table.sort(actual_result) - table.sort(c.expect) - assert_rspamd_table_eq({actual = actual_result, expect = c.expect}) + assert_rspamd_table_eq_sorted({actual = actual_result, expect = c.expect}) end) end @@ -200,9 +196,7 @@ context("Lua util - extract_specific_urls plain", function() print(s) --]] local expect = {"abc.com", "abc.net", "abc.za.org"} - table.sort(actual_result) - table.sort(expect) - assert_rspamd_table_eq({actual = actual_result, expect = expect}) + assert_rspamd_table_eq_sorted({actual = actual_result, expect = expect}) end) end) @@ -257,7 +251,7 @@ context("Lua util - extract_specific_urls message", function() local s = logger.slog("case[%1] %2 =?= %3", i, expect, actual_result) print(s) --]] - assert_rspamd_table_eq({actual = actual_result, expect = {"domain.com"}}) + assert_rspamd_table_eq_sorted({actual = actual_result, expect = {"domain.com"}}) end) test("extract_specific_urls - from email 2 limit", function() @@ -273,7 +267,7 @@ context("Lua util - extract_specific_urls message", function() local s = logger.slog("case[%1] %2 =?= %3", i, expect, actual_result) print(s) --]] - assert_rspamd_table_eq({actual = actual_result, expect = {"domain.com", "example.net"}}) + assert_rspamd_table_eq_sorted({actual = actual_result, expect = {"domain.com", "example.net"}}) end) @@ -300,7 +294,7 @@ context("Lua util - extract_specific_urls message", function() local s = logger.slog("case[%1] %2 =?= %3", i, expect, actual_result) print(s) --]] - assert_rspamd_table_eq({actual = actual_result, expect = {"domain.com"}}) + assert_rspamd_table_eq_sorted({actual = actual_result, expect = {"domain.com"}}) end) test("extract_specific_urls - from email image 2 limit", function() @@ -317,7 +311,7 @@ context("Lua util - extract_specific_urls message", function() local s = logger.slog("case[%1] %2 =?= %3", i, expect, actual_result) print(s) --]] - assert_rspamd_table_eq({actual = actual_result, expect = {"domain.com", "example.net"}}) + assert_rspamd_table_eq_sorted({actual = actual_result, expect = {"domain.com", "example.net"}}) end) test("extract_specific_urls - from email image 3 limit, no images", function() @@ -334,7 +328,7 @@ context("Lua util - extract_specific_urls message", function() local s = logger.slog("case[%1] %2 =?= %3", i, expect, actual_result) print(s) --]] - assert_rspamd_table_eq({actual = actual_result, expect = {"domain.com", "example.net"}}) + assert_rspamd_table_eq_sorted({actual = actual_result, expect = {"domain.com", "example.net"}}) end) test("extract_specific_urls - from email image 3 limit, has images", function() local actual = util.extract_specific_urls({ @@ -350,7 +344,7 @@ context("Lua util - extract_specific_urls message", function() local s = logger.slog("case[%1] %2 =?= %3", i, expect, actual_result) print(s) --]] - assert_rspamd_table_eq({actual = actual_result, + assert_rspamd_table_eq_sorted({actual = actual_result, expect = {"domain.com", "example.net", "example5.org"}}) end) test("extract_specific_urls - from email image 2 limit, has images", function() @@ -367,7 +361,7 @@ context("Lua util - extract_specific_urls message", function() local s = logger.slog("case[%1] %2 =?= %3", i, expect, actual_result) print(s) --]] - assert_rspamd_table_eq({actual = actual_result, + assert_rspamd_table_eq_sorted({actual = actual_result, expect = {"domain.com", "example.net"}}) end) end) |