Add test for zip::urldecode().
This commit is contained in:
parent
59ceaa7cdc
commit
c1613a8f52
|
@ -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]*");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user