Add test for zip::urldecode().

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

View File

@ -70,3 +70,33 @@ SCENARIO("Zip file handling works")
}
}
}
SCENARIO("Helper functions in epubgrep::zip work")
{
SECTION("urldecode() doesn't fail and returns the decoded string")
{
bool exception{false};
GIVEN("The string test%20folder/%2Afile%5Btest%5D%2A")
{
std::string encoded_text{"test%20folder/%2Afile%5Btest%5D%2A"};
std::string decoded_text{};
try
{
decoded_text = epubgrep::zip::urldecode(encoded_text);
}
catch (const std::exception &)
{
exception = true;
}
THEN("No exception is thrown")
AND_THEN("It returns the TOC correctly")
{
REQUIRE_FALSE(exception);
REQUIRE(decoded_text == "test folder/*file[test]*");
}
}
}
}