Skip to content

Commit

Permalink
🔨 fixed a compiler warning
Browse files Browse the repository at this point in the history
Default arguments are forbidden in lambdas.
  • Loading branch information
nlohmann committed Apr 23, 2017
1 parent b686cc6 commit 01e05d8
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions test/src/unit-unicode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,25 @@ using nlohmann::json;

#include <fstream>

std::string create_string(int byte1, int byte2 = -1, int byte3 = -1, int byte4 = -1)
{
std::string result = "\"" + std::string(1, static_cast<char>(byte1));
if (byte2 != -1)
{
result += std::string(1, static_cast<char>(byte2));
}
if (byte3 != -1)
{
result += std::string(1, static_cast<char>(byte3));
}
if (byte4 != -1)
{
result += std::string(1, static_cast<char>(byte4));
}
result += "\"";
return result;
}

TEST_CASE("RFC 3629", "[hide]")
{
/*
Expand All @@ -56,25 +75,6 @@ TEST_CASE("RFC 3629", "[hide]")
UTF8-tail = %x80-BF
*/

auto create_string = [](int byte1, int byte2 = -1, int byte3 = -1, int byte4 = -1)
{
std::string result = "\"" + std::string(1, static_cast<char>(byte1));
if (byte2 != -1)
{
result += std::string(1, static_cast<char>(byte2));
}
if (byte3 != -1)
{
result += std::string(1, static_cast<char>(byte3));
}
if (byte4 != -1)
{
result += std::string(1, static_cast<char>(byte4));
}
result += "\"";
return result;
};

SECTION("ill-formed first byte")
{
for (int byte1 = 0x80; byte1 <= 0xC1; ++byte1)
Expand Down

0 comments on commit 01e05d8

Please sign in to comment.