From 9c307ab0fd245b1de39e71160e86a06294525b90 Mon Sep 17 00:00:00 2001 From: tastytea Date: Wed, 26 May 2021 08:53:48 +0200 Subject: [PATCH] Add test for HTML tags in titles. --- tests/test_search_helpers.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/test_search_helpers.cpp b/tests/test_search_helpers.cpp index 3ecba7e..2050826 100644 --- a/tests/test_search_helpers.cpp +++ b/tests/test_search_helpers.cpp @@ -106,6 +106,28 @@ SCENARIO("Searching helpers work as intended") REQUIRE(text == "Soup"); } } + + WHEN("There is a in the h2 headline") + { + 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("The headline is correctly extracted") + { + REQUIRE_FALSE(exception); + REQUIRE(text == "The long road to nowhere"); + } + } } SECTION("page() does what it should do")