* Tests part
*/
-TEST_CASE("html parsing") {
+TEST_SUITE("html") {
+TEST_CASE("html parsing")
+{
const std::vector<std::pair<std::string, std::string>> cases{
- {"<html><!DOCTYPE html><body>", "+html;++body;"},
- {"<html><div><div></div></div></html>", "+html;++div;+++div;"},
- {"<html><div><div></div></html>", "+html;++div;+++div;"},
- {"<html><div><div></div></html></div>", "+html;++div;+++div;"},
- {"<p><p><a></p></a></a>", "+p;++p;+++a;"},
+ {"<html><!DOCTYPE html><body>", "+html;++body;"},
+ {"<html><div><div></div></div></html>", "+html;++div;+++div;"},
+ {"<html><div><div></div></html>", "+html;++div;+++div;"},
+ {"<html><div><div></div></html></div>", "+html;++div;+++div;"},
+ {"<p><p><a></p></a></a>", "+p;++p;+++a;"},
{"<div><a href=\"http://example.com\"></div></a>", "+div;++a;"},
{"<html><!DOCTYPE html><body><head><body></body></html></body></html>",
- "+html;++body;+++head;++++body;"}
+ "+html;++body;+++head;++++body;"}
};
rspamd_url_init(NULL);
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);
rspamd_mempool_delete(pool);
}
+}
}