1
0
mirror of https://github.com/nlohmann/json.git synced 2025-07-22 15:21:52 +03:00

🚨 removing compiler warnings #755

This commit is contained in:
Niels Lohmann
2017-09-30 11:00:26 +02:00
parent 1a66527dca
commit 8af49d4be5
3 changed files with 17 additions and 17 deletions

View File

@ -451,11 +451,11 @@ TEST_CASE("deserialization")
SECTION("BOM only")
{
CHECK_THROWS_AS(json::parse(bom), json::parse_error);
CHECK_THROWS_AS(json::parse(bom), json::parse_error&);
CHECK_THROWS_WITH(json::parse(bom),
"[json.exception.parse_error.101] parse error at 1: syntax error - unexpected end of input; expected '[', '{', or a literal");
CHECK_THROWS_AS(json::parse(std::istringstream(bom)), json::parse_error);
CHECK_THROWS_AS(json::parse(std::istringstream(bom)), json::parse_error&);
CHECK_THROWS_WITH(json::parse(std::istringstream(bom)),
"[json.exception.parse_error.101] parse error at 1: syntax error - unexpected end of input; expected '[', '{', or a literal");
}
@ -468,22 +468,22 @@ TEST_CASE("deserialization")
SECTION("2 byte of BOM")
{
CHECK_THROWS_AS(json::parse(bom.substr(0, 2)), json::parse_error);
CHECK_THROWS_AS(json::parse(bom.substr(0, 2)), json::parse_error&);
CHECK_THROWS_WITH(json::parse(bom),
"[json.exception.parse_error.101] parse error at 1: syntax error - unexpected end of input; expected '[', '{', or a literal");
CHECK_THROWS_AS(json::parse(std::istringstream(bom.substr(0, 2))), json::parse_error);
CHECK_THROWS_AS(json::parse(std::istringstream(bom.substr(0, 2))), json::parse_error&);
CHECK_THROWS_WITH(json::parse(std::istringstream(bom)),
"[json.exception.parse_error.101] parse error at 1: syntax error - unexpected end of input; expected '[', '{', or a literal");
}
SECTION("1 byte of BOM")
{
CHECK_THROWS_AS(json::parse(bom.substr(0, 1)), json::parse_error);
CHECK_THROWS_AS(json::parse(bom.substr(0, 1)), json::parse_error&);
CHECK_THROWS_WITH(json::parse(bom),
"[json.exception.parse_error.101] parse error at 1: syntax error - unexpected end of input; expected '[', '{', or a literal");
CHECK_THROWS_AS(json::parse(std::istringstream(bom.substr(0, 1))), json::parse_error);
CHECK_THROWS_AS(json::parse(std::istringstream(bom.substr(0, 1))), json::parse_error&);
CHECK_THROWS_WITH(json::parse(std::istringstream(bom)),
"[json.exception.parse_error.101] parse error at 1: syntax error - unexpected end of input; expected '[', '{', or a literal");
}
@ -504,9 +504,9 @@ TEST_CASE("deserialization")
CAPTURE(i2);
std::string s = "";
s.push_back(bom[0] + i0);
s.push_back(bom[1] + i1);
s.push_back(bom[2] + i2);
s.push_back(static_cast<char>(bom[0] + i0));
s.push_back(static_cast<char>(bom[1] + i1));
s.push_back(static_cast<char>(bom[2] + i2));
if (i0 == 0 and i1 == 0 and i2 == 0)
{
@ -517,8 +517,8 @@ TEST_CASE("deserialization")
else
{
// any variation is an error
CHECK_THROWS_AS(json::parse(s + "null"), json::parse_error);
CHECK_THROWS_AS(json::parse(std::istringstream(s + "null")), json::parse_error);
CHECK_THROWS_AS(json::parse(s + "null"), json::parse_error&);
CHECK_THROWS_AS(json::parse(std::istringstream(s + "null")), json::parse_error&);
}
}
}