diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2021-01-29 11:38:56 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2021-01-29 11:38:56 +0000 |
commit | 67857e64c268fe2dc04e425c74e37c4859edfd58 (patch) | |
tree | 7dc5b34907e3297c8634da5065d5c7888f92c6e7 /test/lua/unit/css.lua | |
parent | 095fb4617c45c64a17d75d888aca2cc1d03548ae (diff) | |
download | rspamd-67857e64c268fe2dc04e425c74e37c4859edfd58.tar.gz rspamd-67857e64c268fe2dc04e425c74e37c4859edfd58.zip |
[Minor] Css: Add a simple testing logic for css parsing
Diffstat (limited to 'test/lua/unit/css.lua')
-rw-r--r-- | test/lua/unit/css.lua | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/lua/unit/css.lua b/test/lua/unit/css.lua index 8d4d4469b..ad7d2762c 100644 --- a/test/lua/unit/css.lua +++ b/test/lua/unit/css.lua @@ -7,11 +7,15 @@ const char *rspamd_css_unescape (void *pool, const char *begin, size_t len, size_t *olen); +void* rspamd_css_parse_style (void *pool, + const char *begin, + size_t len, void *err); ]] local cases = { {'#\\31 a2b3c {', '#1a2b3c {'} } + for _,t in ipairs(cases) do test("Unescape " .. t[1], function() local olen = ffi.new('size_t[1]') @@ -20,4 +24,19 @@ const char *rspamd_css_unescape (void *pool, assert_equal(escaped, t[2], escaped .. " not equal " .. t[2]) end) end + + local cases = {[[ +p { + color: red; + text-align: center; +} +]] + } + local NULL = ffi.new 'void*' + for i,t in ipairs(cases) do + test("Parse css sample " .. i, function() + local escaped = ffi.C.rspamd_css_parse_style(pool:topointer(), t, #t, NULL) + assert_not_null(escaped) + end) + end end)
\ No newline at end of file |