diff --git a/tests/test_search_helpers.cpp b/tests/test_search_helpers.cpp index 2050826..0eb564a 100644 --- a/tests/test_search_helpers.cpp +++ b/tests/test_search_helpers.cpp @@ -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 = "
The long
road to nowhere
"; + 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")