commit b0a535c: [Test] Adjust tests

Vsevolod Stakhov vsevolod at highsecure.ru
Thu Sep 26 11:14:06 UTC 2019


Author: Vsevolod Stakhov
Date: 2019-09-26 12:10:50 +0100
URL: https://github.com/rspamd/rspamd/commit/b0a535c17f7db5ce436a40425e9d2cad2555e0f9 (HEAD -> master)

[Test] Adjust tests

---
 test/lua/unit/addr.lua     | 4 ++--
 test/lua/unit/received.lua | 5 +++++
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/test/lua/unit/addr.lua b/test/lua/unit/addr.lua
index a021b1cba..6da72d316 100644
--- a/test/lua/unit/addr.lua
+++ b/test/lua/unit/addr.lua
@@ -6,7 +6,7 @@ context("Inet addr check functions", function()
   ffi.cdef[[
   typedef struct rspamd_inet_addr_s rspamd_inet_addr_t;
   bool rspamd_parse_inet_address (rspamd_inet_addr_t **target,
-    const char *src);
+    const char *src, size_t len);
   void rspamd_inet_address_free (rspamd_inet_addr_t *addr);
   ]]
 
@@ -35,7 +35,7 @@ context("Inet addr check functions", function()
   for i,c in ipairs(cases) do
     test("Create inet addr from string " .. c[1] .. '; expect ' .. tostring(c[2]), function()
       local ip = ffi.new("rspamd_inet_addr_t* [1]");
-      local res = ffi.C.rspamd_parse_inet_address(ip, c[1])
+      local res = ffi.C.rspamd_parse_inet_address(ip, c[1], #c[1])
       assert_equal(res, c[2], "Expect " .. tostring(c[2]) .. " while parsing " .. c[1])
       if res then
         ffi.C.rspamd_inet_address_free(ip[0])
diff --git a/test/lua/unit/received.lua b/test/lua/unit/received.lua
index c633a99b1..fc1f24de8 100644
--- a/test/lua/unit/received.lua
+++ b/test/lua/unit/received.lua
@@ -117,6 +117,11 @@ context("Received headers parser", function()
        by_hostname = 'mail01.someotherdomain.org',
      }
     },
+    {[[from example.com ([]) by example.com with ESMTP id 2019091111 ; Thu, 26 Sep 2019 11:19:07 +0200]],
+      {
+        by_hostname = 'example.com',
+      },
+    }
   }
 
   local task = ffi.C.rspamd_task_new(nil, nil)


More information about the Commits mailing list