summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-02-07 15:51:34 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-02-07 15:51:34 +0000
commitc5e2e9babb03058cb94320a6e1fe7002c247fb5a (patch)
treec6752143fc246d3e173f31d3f777159b16145368 /test
parentb0ffaff883afd82f04420e5cf3e7ae45b90c5acf (diff)
downloadrspamd-c5e2e9babb03058cb94320a6e1fe7002c247fb5a.tar.gz
rspamd-c5e2e9babb03058cb94320a6e1fe7002c247fb5a.zip
[Test] Try to fix bloody ambiguity in IPv6 notations...
Diffstat (limited to 'test')
-rw-r--r--test/lua/unit/received.lua13
1 files changed, 9 insertions, 4 deletions
diff --git a/test/lua/unit/received.lua b/test/lua/unit/received.lua
index 8185d9ada..75fd3701c 100644
--- a/test/lua/unit/received.lua
+++ b/test/lua/unit/received.lua
@@ -2,6 +2,7 @@
context("Received headers parser", function()
local ffi = require("ffi")
+ local rspamd_ip = require "rspamd_ip"
ffi.cdef[[
struct received_header {
@@ -119,9 +120,11 @@ context("Received headers parser", function()
end
elseif k == 'from_ip' then
if #v > 0 then
- assert_equal(v, ffi_string(hdr.from_ip),
+ local got_string = tostring(rspamd_ip.from_string(ffi_string(hdr.from_ip)))
+ local expected_string = tostring(rspamd_ip.from_string(v))
+ assert_equal(expected_string, got_string,
string.format('%s: from_ip: %s, expected: %s',
- c[1], ffi_string(hdr.from_ip), v))
+ expected_string, got_string, v))
else
assert_nil(hdr.from_ip,
string.format('%s: from_ip: %s, expected: nil',
@@ -129,9 +132,11 @@ context("Received headers parser", function()
end
elseif k == 'real_ip' then
if #v > 0 then
- assert_equal(v, ffi_string(hdr.real_ip),
+ local got_string = tostring(rspamd_ip.from_string(ffi_string(hdr.from_ip)))
+ local expected_string = tostring(rspamd_ip.from_string(v))
+ assert_equal(expected_string, got_string,
string.format('%s: real_ip: %s, expected: %s',
- c[1], ffi_string(hdr.real_ip), v))
+ expected_string, got_string, v))
else
assert_nil(hdr.real_ip,
string.format('%s: real_ip: %s, expected: nil',