diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2021-06-20 12:24:45 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2021-06-20 12:24:45 +0100 |
commit | 420725bcd0ce4f580e7aa98a0c7a6b3c8ff49e6d (patch) | |
tree | 1cf3dfbf27440c273774609a05bf0516b1d7c3b8 /src | |
parent | 4395db507d29539c1b828813c0a7e3e2d09cdaa3 (diff) | |
download | rspamd-420725bcd0ce4f580e7aa98a0c7a6b3c8ff49e6d.tar.gz rspamd-420725bcd0ce4f580e7aa98a0c7a6b3c8ff49e6d.zip |
[Test] Rework some tests to subcases
Diffstat (limited to 'src')
-rw-r--r-- | src/libserver/css/css_parser.cxx | 18 | ||||
-rw-r--r-- | src/libserver/css/css_value.cxx | 12 | ||||
-rw-r--r-- | src/libserver/html/html_entities.cxx | 2 |
3 files changed, 19 insertions, 13 deletions
diff --git a/src/libserver/css/css_parser.cxx b/src/libserver/css/css_parser.cxx index bac5a72eb..bcff14f75 100644 --- a/src/libserver/css/css_parser.cxx +++ b/src/libserver/css/css_parser.cxx @@ -860,17 +860,21 @@ TEST_SUITE("css") { rspamd_mempool_t *pool = rspamd_mempool_new(rspamd_mempool_suggest_size(), "css", 0); for (const auto &c : cases) { - CHECK(parse_css(pool, c, nullptr).value().get() != nullptr); + SUBCASE((std::string("parse css: ") + c).c_str()) { + CHECK(parse_css(pool, c, nullptr).value().get() != nullptr); + } } /* We now merge all styles together */ - std::shared_ptr<css_style_sheet> merged; - for (const auto &c : cases) { - auto ret = parse_css(pool, c, std::move(merged)); - merged.swap(ret.value()); - } + SUBCASE("merged css parse") { + std::shared_ptr<css_style_sheet> merged; + for (const auto &c : cases) { + auto ret = parse_css(pool, c, std::move(merged)); + merged.swap(ret.value()); + } - CHECK(merged.get() != nullptr); + CHECK(merged.get() != nullptr); + } rspamd_mempool_delete(pool); } diff --git a/src/libserver/css/css_value.cxx b/src/libserver/css/css_value.cxx index 87d6ceb85..6988ea993 100644 --- a/src/libserver/css/css_value.cxx +++ b/src/libserver/css/css_value.cxx @@ -388,11 +388,13 @@ TEST_SUITE("css") { }; for (const auto &p : hex_tests) { - auto col_parsed = css_value::maybe_color_from_hex(p.first); - //CHECK_UNARY(col_parsed); - //CHECK_UNARY(col_parsed.value().to_color()); - auto final_col = col_parsed.value().to_color().value(); - CHECK(final_col == p.second); + SUBCASE((std::string("parse hex color: ") + p.first).c_str()) { + auto col_parsed = css_value::maybe_color_from_hex(p.first); + //CHECK_UNARY(col_parsed); + //CHECK_UNARY(col_parsed.value().to_color()); + auto final_col = col_parsed.value().to_color().value(); + CHECK(final_col == p.second); + } } } TEST_CASE("css colors strings") { diff --git a/src/libserver/html/html_entities.cxx b/src/libserver/html/html_entities.cxx index 1d72574b3..2cc3c11f5 100644 --- a/src/libserver/html/html_entities.cxx +++ b/src/libserver/html/html_entities.cxx @@ -2578,7 +2578,7 @@ TEST_SUITE("html") { }; for (const auto &c : cases) { - SUBCASE(c.first.c_str()) { + SUBCASE(("decode entities: " + c.first).c_str()) { auto *cpy = new char[c.first.size()]; memcpy(cpy, c.first.data(), c.first.size()); auto nlen = decode_html_entitles_inplace(cpy, c.first.size(), true); |