2020-01-16 18:16:02 +01:00
|
|
|
/* This file is part of mastodonpp.
|
|
|
|
* Copyright © 2020 tastytea <tastytea@tastytea.de>
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License as published by
|
|
|
|
* the Free Software Foundation, version 3.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Affero General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "helpers.hpp"
|
|
|
|
|
|
|
|
#include <catch.hpp>
|
|
|
|
|
|
|
|
#include <exception>
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
namespace mastodonpp
|
|
|
|
{
|
|
|
|
|
|
|
|
using std::string;
|
|
|
|
|
2020-11-13 14:01:09 +01:00
|
|
|
SCENARIO("mastodonpp::html_unescape()")
|
2020-01-16 18:16:02 +01:00
|
|
|
{
|
|
|
|
bool exception = false;
|
|
|
|
|
2020-11-13 14:01:09 +01:00
|
|
|
WHEN("html_unescape() is called.")
|
2020-01-16 18:16:02 +01:00
|
|
|
{
|
|
|
|
string result;
|
|
|
|
try
|
|
|
|
{
|
|
|
|
result = unescape_html("2€ = 2€ = 2€");
|
|
|
|
}
|
|
|
|
catch (const std::exception &e)
|
|
|
|
{
|
|
|
|
exception = true;
|
|
|
|
}
|
|
|
|
|
2020-11-13 14:01:09 +01:00
|
|
|
THEN("No exception is thrown")
|
|
|
|
AND_THEN("Result is as expected.")
|
2020-01-16 18:16:02 +01:00
|
|
|
{
|
|
|
|
REQUIRE_FALSE(exception);
|
|
|
|
REQUIRE(result == "2€ = 2€ = 2€");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace mastodonpp
|