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);
}
};
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") {
};
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);
};
for (const auto &c : cases) {
- auto *cpy = new char[c.first.size()];
- 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;
+ SUBCASE (("strip comments in " + c.first).c_str()) {
+ auto *cpy = new char[c.first.size()];
+ 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;
+ }
}
}