Add another test for search::headline().

This commit is contained in:
tastytea 2021-05-29 23:00:40 +02:00
parent 790e60a055
commit 59ceaa7cdc
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
1 changed files with 21 additions and 0 deletions

View File

@ -128,6 +128,27 @@ SCENARIO("Searching helpers work as intended")
REQUIRE(text == "The long road to nowhere");
}
}
WHEN("There are tags that start with h but are not headlines")
{
text = "<html><hr>The long<section>road to nowhere</section>";
try
{
epubgrep::search::cleanup_text(text);
text = epubgrep::search::headline(text);
}
catch (const std::exception &)
{
exception = true;
}
THEN("No exception is thrown")
AND_THEN("No headline is extracted")
{
REQUIRE_FALSE(exception);
REQUIRE(text.empty());
}
}
}
SECTION("page() does what it should do")