diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2021-01-22 15:49:55 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2021-01-22 15:58:05 +0000 |
commit | de3370d428c0c7f6998f21a3831a3c4e2c165e23 (patch) | |
tree | 6acb2c4571ec9f1db66c79457bc767361096aacc /test | |
parent | f64087e3f991ccab5b3556c02fe7d13a247cda54 (diff) | |
download | rspamd-de3370d428c0c7f6998f21a3831a3c4e2c165e23.tar.gz rspamd-de3370d428c0c7f6998f21a3831a3c4e2c165e23.zip |
[Test] Start css unit testing
Diffstat (limited to 'test')
-rw-r--r-- | test/lua/unit/css.lua | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/lua/unit/css.lua b/test/lua/unit/css.lua new file mode 100644 index 000000000..8d4d4469b --- /dev/null +++ b/test/lua/unit/css.lua @@ -0,0 +1,23 @@ +context("CSS parsing tests", function() + local ffi = require("ffi") + local rspamd_mempool = require "rspamd_mempool" + local pool = rspamd_mempool.create() + ffi.cdef[[ +const char *rspamd_css_unescape (void *pool, + const char *begin, + size_t len, + size_t *olen); +]] + + local cases = { + {'#\\31 a2b3c {', '#1a2b3c {'} + } + for _,t in ipairs(cases) do + test("Unescape " .. t[1], function() + local olen = ffi.new('size_t[1]') + local escaped = ffi.C.rspamd_css_unescape(pool:topointer(), t[1], #t[1], olen) + escaped = ffi.string(escaped, tonumber(olen[0])) + assert_equal(escaped, t[2], escaped .. " not equal " .. t[2]) + end) + end +end)
\ No newline at end of file |