diff options
author | Vsevolod Stakhov <vsevolod@rspamd.com> | 2024-03-24 14:51:29 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rspamd.com> | 2024-03-24 14:51:29 +0000 |
commit | 417cdf6aa30054c703da5ce8a3185412ed532477 (patch) | |
tree | 951c3b4743197de5b22be143c6764eee47301b68 /test/lua | |
parent | 2038f3c92afaaeceab3e7107a38c06f8d555ae53 (diff) | |
download | rspamd-417cdf6aa30054c703da5ce8a3185412ed532477.tar.gz rspamd-417cdf6aa30054c703da5ce8a3185412ed532477.zip |
[Test] Add unit test
Diffstat (limited to 'test/lua')
-rw-r--r-- | test/lua/unit/url.lua | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/lua/unit/url.lua b/test/lua/unit/url.lua index 52b88d25a..e25005eca 100644 --- a/test/lua/unit/url.lua +++ b/test/lua/unit/url.lua @@ -250,4 +250,15 @@ context("URL check functions", function() assert_equal(v[2], res, 'expected ' .. v[2] .. ' but got ' .. res .. ' in url ' .. v[1]) end) end + + test("URL regexp issue", function() + local rspamd_regexp = require "rspamd_regexp" + local u = url.create(pool, + 'https://cls21.bullhornstaffing.com/MailerUnsubscribe.cfm?privateLabelID=3D26028&email=xpto&updKey=3D%3B%28U%2B%2F%200T%3EI%3B%2FQEI%5E%29%25XR%3FZ%40%5B%2EGJY%3CF%23%3F%25%22%29%5D%2D%0A') + assert_not_nil(u, "we are able to parse url") + local re = rspamd_regexp.create_cached("^$|^[?].*|^[#].*|[^#?]+") + assert_not_nil(re, "regexp is valid") + local res = re:search('/' .. u:get_path() .. '?' .. u:get_query()) + assert_equal(res[#res], '') + end) end) |