From: Vsevolod Stakhov Date: Fri, 18 Jun 2021 19:35:05 +0000 (+0100) Subject: [Test] Slightly reorganize tests X-Git-Tag: 3.0~274 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=447755d6c8951bdf9593dab9593dac368bcaa372;p=rspamd.git [Test] Slightly reorganize tests --- diff --git a/src/libserver/css/css_parser.cxx b/src/libserver/css/css_parser.cxx index 6943e1cf6..bac5a72eb 100644 --- a/src/libserver/css/css_parser.cxx +++ b/src/libserver/css/css_parser.cxx @@ -817,7 +817,7 @@ parse_css_declaration(rspamd_mempool_t *pool, const std::string_view &st) return nullptr; } -TEST_SUITE("css parser") { +TEST_SUITE("css") { TEST_CASE("parse colors") { const std::vector cases{ "P { CoLoR: rgb(100%, 50%, 0%); opacity: -1; width: 1em; display: none; } /* very transparent solid orange тест */", diff --git a/src/libserver/css/css_rule.cxx b/src/libserver/css/css_rule.cxx index 52003ac23..d8c3a04dd 100644 --- a/src/libserver/css/css_rule.cxx +++ b/src/libserver/css/css_rule.cxx @@ -500,7 +500,7 @@ void css_rule::add_value(const css_value &value) } -TEST_SUITE("css rules") { +TEST_SUITE("css") { TEST_CASE("simple css rules") { const std::vector>> cases{ { diff --git a/src/libserver/css/css_selector.cxx b/src/libserver/css/css_selector.cxx index a4e1eb566..28b64a9fd 100644 --- a/src/libserver/css/css_selector.cxx +++ b/src/libserver/css/css_selector.cxx @@ -191,7 +191,7 @@ css_selector::debug_str() const -> std::string return ret; } -TEST_SUITE("css selectors") { +TEST_SUITE("css") { TEST_CASE("simple css selectors") { const std::vector>> cases{ {"em", {css_selector::selector_type::SELECTOR_TAG}}, diff --git a/src/libserver/css/css_value.cxx b/src/libserver/css/css_value.cxx index d187f1031..87d6ceb85 100644 --- a/src/libserver/css/css_value.cxx +++ b/src/libserver/css/css_value.cxx @@ -377,7 +377,7 @@ auto css_value::debug_str() const -> std::string { return ret; } -TEST_SUITE("css values") { +TEST_SUITE("css") { TEST_CASE("css hex colors") { const std::pair hex_tests[] = { {"000", css_color(0, 0, 0)}, diff --git a/src/libserver/html/html.cxx b/src/libserver/html/html.cxx index bb6d8b725..073b733a2 100644 --- a/src/libserver/html/html.cxx +++ b/src/libserver/html/html.cxx @@ -1796,17 +1796,19 @@ auto html_tag_by_name(const std::string_view &name) * Tests part */ -TEST_CASE("html parsing") { +TEST_SUITE("html") { +TEST_CASE("html parsing") +{ const std::vector> cases{ - {"", "+html;++body;"}, - {"
", "+html;++div;+++div;"}, - {"
", "+html;++div;+++div;"}, - {"
", "+html;++div;+++div;"}, - {"

", "+p;++p;+++a;"}, + {"", "+html;++body;"}, + {"
", "+html;++div;+++div;"}, + {"
", "+html;++div;+++div;"}, + {"
", "+html;++div;+++div;"}, + {"

", "+p;++p;+++a;"}, {"
", "+div;++a;"}, {"", - "+html;++body;+++head;++++body;"} + "+html;++body;+++head;++++body;"} }; rspamd_url_init(NULL); @@ -1815,7 +1817,7 @@ TEST_CASE("html parsing") { for (const auto &c : cases) { GByteArray *tmp = g_byte_array_sized_new(c.first.size()); - g_byte_array_append(tmp, (const guint8 *)c.first.data(), c.first.size()); + g_byte_array_append(tmp, (const guint8 *) c.first.data(), c.first.size()); auto *hc = html_process_input(pool, tmp, nullptr, nullptr, nullptr, true); CHECK(hc != nullptr); auto dump = html_debug_structure(*hc); @@ -1825,6 +1827,7 @@ TEST_CASE("html parsing") { rspamd_mempool_delete(pool); } +} } diff --git a/test/rspamd_cxx_unit_utils.hxx b/test/rspamd_cxx_unit_utils.hxx index a65adab70..f5c532ff5 100644 --- a/test/rspamd_cxx_unit_utils.hxx +++ b/test/rspamd_cxx_unit_utils.hxx @@ -46,6 +46,7 @@ TEST_CASE("rspamd_strip_smtp_comments_inplace") { memcpy(cpy, c.first.data(), c.first.size()); auto nlen = rspamd_strip_smtp_comments_inplace(cpy, c.first.size()); CHECK(std::string{cpy,nlen} == c.second); + delete[] cpy; } }