1
0
Fork 0
mirror of https://github.com/KingDuckZ/kamokan.git synced 2025-10-02 15:00:02 +00:00

Use stock std::string conversion.

This commit is contained in:
King_DuckZ 2017-06-07 00:19:53 +01:00
commit 056e7dcde4
9 changed files with 22 additions and 41 deletions

View file

@ -48,9 +48,9 @@ namespace tawashi {
) const {
SubmittedPastie pastie;
std::string token = num_to_token(m_submission_num++);
pastie.text = std::string(parText.data(), parText.size());
pastie.text = std::string(parText);
pastie.expiry = parExpiry;
pastie.lang = std::string(parLang.data(), parLang.size());
pastie.lang = std::string(parLang);
pastie.remote_ip = parRemoteIP;
pastie.token = token;
m_submitted_pasties.push_back(std::move(pastie));

View file

@ -18,12 +18,6 @@
#include "catch.hpp"
#include "mime_split.hpp"
namespace {
std::string to_string (const boost::string_ref& parRef) {
return std::string(parRef.data(), parRef.size());
}
} //unnamed namespace
TEST_CASE ("Test the string_to_mime parser", "[mime][parser]") {
using tawashi::SplitMime;
using tawashi::string_to_mime;
@ -42,7 +36,7 @@ TEST_CASE ("Test the string_to_mime parser", "[mime][parser]") {
REQUIRE(split.parameters.size() == 1);
CHECK(split.parameters.find("charset") != split.parameters.end());
curr_val = to_string(split.parameters.at("charset"));
curr_val = std::string(split.parameters.at("charset"));
CHECK(curr_val == "UTF-8");
}
@ -58,11 +52,11 @@ TEST_CASE ("Test the string_to_mime parser", "[mime][parser]") {
REQUIRE(split.parameters.size() == 2);
CHECK(split.parameters.find("filename") != split.parameters.end());
curr_val = to_string(split.parameters.at("filename"));
curr_val = std::string(split.parameters.at("filename"));
CHECK(curr_val == "genome.jpeg");
CHECK(split.parameters.find("modification-date") != split.parameters.end());
curr_val = to_string(split.parameters.at("modification-date"));
curr_val = std::string(split.parameters.at("modification-date"));
CHECK(curr_val == "Wed, 12 Feb 1997 16:29:51 -0500");
}
}