From: Vsevolod Stakhov Date: Mon, 28 Jun 2021 13:01:25 +0000 (+0100) Subject: [Test] Some fixes to html unit tests X-Git-Tag: 3.0~234 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=ee9655827a5d7daef68160c4c969d91e2ff73aa3;p=rspamd.git [Test] Some fixes to html unit tests --- diff --git a/test/lua/unit/html.lua b/test/lua/unit/html.lua index 79d55502e..8582c4edc 100644 --- a/test/lua/unit/html.lua +++ b/test/lua/unit/html.lua @@ -1,31 +1,11 @@ context("HTML processing", function() local rspamd_util = require("rspamd_util") local logger = require("rspamd_logger") - - test("Extract text from HTML", function() - local cases = { + local cases = { -- Entities {[[.firebaseapp.com]], [[.firebaseapp.com]]}, {[[ - - - - - title - - - - - - Hello, world! test -

data<> -

- stuff

? - - - ]], "Hello, world! test\r\ndata\r\nstuff\r\n?"}, - {[[ - ]], 'Hello, world!\r\n'}, + ]], 'Hello, world!\n'}, {[[ @@ -76,7 +56,7 @@ context("HTML processing", function() - ]], 'Hello, world!\r\ntest\r\ncontent\r\nmore content\r\ncontent inside div\r\n'}, + ]], 'Hello, world!\ntest\ncontent\nmore content\ncontent inside div\n'}, {[[ @@ -103,7 +83,7 @@ context("HTML processing", function() - ]], 'content\r\nheada headb\r\ndata1 data2\r\n'}, + ]], 'content\nheada headb\ndata1 data2\n'}, {[[ @@ -118,14 +98,16 @@ context("HTML processing", function() ]], 'a b a > b a < b a & b \'a "a"'}, - } + } - for _,c in ipairs(cases) do + for i,c in ipairs(cases) do + test("Extract text from HTML " .. tostring(i), function() local t = rspamd_util.parse_html(c[1]) assert_not_nil(t) assert_equal(c[2], tostring(t), string.format("'%s' doesn't match with '%s'", c[2], t)) - end - end) + + end) + end end)