commit 2ff5ecb: [Test] Add more tests

Vsevolod Stakhov vsevolod at highsecure.ru
Fri Jan 10 16:21:08 UTC 2020


Author: Vsevolod Stakhov
Date: 2020-01-10 16:16:56 +0000
URL: https://github.com/rspamd/rspamd/commit/2ff5ecbe9b17c055ac3e97dee2c1085b3903addd (HEAD -> master)

[Test] Add more tests

---
 test/lua/unit/url.lua | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/test/lua/unit/url.lua b/test/lua/unit/url.lua
index 269b7841b..894c3156e 100644
--- a/test/lua/unit/url.lua
+++ b/test/lua/unit/url.lua
@@ -56,6 +56,15 @@ context("URL check functions", function()
   end
 
   cases = {
+    {"http:/\\[::eeee:192.168.0.1]/#test", true, {
+      host = '::eeee:c0a8:1', fragment = 'test'
+    }},
+    {"http:/\\[::eeee:192.168.0.1]#test", true, {
+      host = '::eeee:c0a8:1', fragment = 'test'
+    }},
+    {"http:/\\[::eeee:192.168.0.1]?test", true, {
+      host = '::eeee:c0a8:1', query = 'test'
+    }},
     {"http:\\\\%30%78%63%30%2e%30%32%35%30.01", true, { --0xc0.0250.01
       host = '192.168.0.1',
     }},
@@ -89,9 +98,6 @@ context("URL check functions", function()
     {"http://192.168.0.1.?foo", true, {
       host = '192.168.0.1', query = 'foo',
     }},
-    {"http:/\\[::eeee:192.168.0.1]#test", true, {
-      host = '::eeee:c0a8:1', fragment = 'test'
-    }},
     {"http://twitter.com#test", true, {
       host = 'twitter.com', fragment = 'test'
     }},
@@ -104,9 +110,9 @@ context("URL check functions", function()
   for i,c in ipairs(cases) do
     local res = url.create(pool, c[1])
 
-    test("Parse urls " .. i, function()
+    test("Parse url: " .. c[1], function()
       if c[2] then
-        assert_not_nil(res, "cannot parse " .. c[1])
+        assert_not_nil(res, "we are able to parse url: " .. c[1])
 
         local uf = res:to_table()
 


More information about the Commits mailing list