mirror of
https://github.com/nlohmann/json.git
synced 2025-07-27 00:41:05 +03:00
🔨 fixed some pedantic GCC warnings
This commit is contained in:
@ -63,8 +63,8 @@ TEST_CASE("element access 2")
|
||||
|
||||
SECTION("access outside bounds")
|
||||
{
|
||||
CHECK_THROWS_AS(j.at("foo"), json::out_of_range);
|
||||
CHECK_THROWS_AS(j_const.at("foo"), json::out_of_range);
|
||||
CHECK_THROWS_AS(j.at("foo"), json::out_of_range&);
|
||||
CHECK_THROWS_AS(j_const.at("foo"), json::out_of_range&);
|
||||
CHECK_THROWS_WITH(j.at("foo"),
|
||||
"[json.exception.out_of_range.403] key 'foo' not found");
|
||||
CHECK_THROWS_WITH(j_const.at("foo"),
|
||||
@ -77,8 +77,8 @@ TEST_CASE("element access 2")
|
||||
{
|
||||
json j_nonobject(json::value_t::null);
|
||||
const json j_nonobject_const(j_nonobject);
|
||||
CHECK_THROWS_AS(j_nonobject.at("foo"), json::type_error);
|
||||
CHECK_THROWS_AS(j_nonobject_const.at("foo"), json::type_error);
|
||||
CHECK_THROWS_AS(j_nonobject.at("foo"), json::type_error&);
|
||||
CHECK_THROWS_AS(j_nonobject_const.at("foo"), json::type_error&);
|
||||
CHECK_THROWS_WITH(j_nonobject.at("foo"), "[json.exception.type_error.304] cannot use at() with null");
|
||||
CHECK_THROWS_WITH(j_nonobject_const.at("foo"), "[json.exception.type_error.304] cannot use at() with null");
|
||||
}
|
||||
@ -87,8 +87,8 @@ TEST_CASE("element access 2")
|
||||
{
|
||||
json j_nonobject(json::value_t::boolean);
|
||||
const json j_nonobject_const(j_nonobject);
|
||||
CHECK_THROWS_AS(j_nonobject.at("foo"), json::type_error);
|
||||
CHECK_THROWS_AS(j_nonobject_const.at("foo"), json::type_error);
|
||||
CHECK_THROWS_AS(j_nonobject.at("foo"), json::type_error&);
|
||||
CHECK_THROWS_AS(j_nonobject_const.at("foo"), json::type_error&);
|
||||
CHECK_THROWS_WITH(j_nonobject.at("foo"), "[json.exception.type_error.304] cannot use at() with boolean");
|
||||
CHECK_THROWS_WITH(j_nonobject_const.at("foo"), "[json.exception.type_error.304] cannot use at() with boolean");
|
||||
}
|
||||
@ -97,8 +97,8 @@ TEST_CASE("element access 2")
|
||||
{
|
||||
json j_nonobject(json::value_t::string);
|
||||
const json j_nonobject_const(j_nonobject);
|
||||
CHECK_THROWS_AS(j_nonobject.at("foo"), json::type_error);
|
||||
CHECK_THROWS_AS(j_nonobject_const.at("foo"), json::type_error);
|
||||
CHECK_THROWS_AS(j_nonobject.at("foo"), json::type_error&);
|
||||
CHECK_THROWS_AS(j_nonobject_const.at("foo"), json::type_error&);
|
||||
CHECK_THROWS_WITH(j_nonobject.at("foo"), "[json.exception.type_error.304] cannot use at() with string");
|
||||
CHECK_THROWS_WITH(j_nonobject_const.at("foo"), "[json.exception.type_error.304] cannot use at() with string");
|
||||
}
|
||||
@ -107,8 +107,8 @@ TEST_CASE("element access 2")
|
||||
{
|
||||
json j_nonobject(json::value_t::array);
|
||||
const json j_nonobject_const(j_nonobject);
|
||||
CHECK_THROWS_AS(j_nonobject.at("foo"), json::type_error);
|
||||
CHECK_THROWS_AS(j_nonobject_const.at("foo"), json::type_error);
|
||||
CHECK_THROWS_AS(j_nonobject.at("foo"), json::type_error&);
|
||||
CHECK_THROWS_AS(j_nonobject_const.at("foo"), json::type_error&);
|
||||
CHECK_THROWS_WITH(j_nonobject.at("foo"), "[json.exception.type_error.304] cannot use at() with array");
|
||||
CHECK_THROWS_WITH(j_nonobject_const.at("foo"), "[json.exception.type_error.304] cannot use at() with array");
|
||||
}
|
||||
@ -117,8 +117,8 @@ TEST_CASE("element access 2")
|
||||
{
|
||||
json j_nonobject(json::value_t::number_integer);
|
||||
const json j_nonobject_const(j_nonobject);
|
||||
CHECK_THROWS_AS(j_nonobject.at("foo"), json::type_error);
|
||||
CHECK_THROWS_AS(j_nonobject_const.at("foo"), json::type_error);
|
||||
CHECK_THROWS_AS(j_nonobject.at("foo"), json::type_error&);
|
||||
CHECK_THROWS_AS(j_nonobject_const.at("foo"), json::type_error&);
|
||||
CHECK_THROWS_WITH(j_nonobject.at("foo"), "[json.exception.type_error.304] cannot use at() with number");
|
||||
CHECK_THROWS_WITH(j_nonobject_const.at("foo"), "[json.exception.type_error.304] cannot use at() with number");
|
||||
}
|
||||
@ -127,8 +127,8 @@ TEST_CASE("element access 2")
|
||||
{
|
||||
json j_nonobject(json::value_t::number_unsigned);
|
||||
const json j_nonobject_const(j_nonobject);
|
||||
CHECK_THROWS_AS(j_nonobject.at("foo"), json::type_error);
|
||||
CHECK_THROWS_AS(j_nonobject_const.at("foo"), json::type_error);
|
||||
CHECK_THROWS_AS(j_nonobject.at("foo"), json::type_error&);
|
||||
CHECK_THROWS_AS(j_nonobject_const.at("foo"), json::type_error&);
|
||||
CHECK_THROWS_WITH(j_nonobject.at("foo"), "[json.exception.type_error.304] cannot use at() with number");
|
||||
CHECK_THROWS_WITH(j_nonobject_const.at("foo"), "[json.exception.type_error.304] cannot use at() with number");
|
||||
}
|
||||
@ -137,8 +137,8 @@ TEST_CASE("element access 2")
|
||||
{
|
||||
json j_nonobject(json::value_t::number_float);
|
||||
const json j_nonobject_const(j_nonobject);
|
||||
CHECK_THROWS_AS(j_nonobject.at("foo"), json::type_error);
|
||||
CHECK_THROWS_AS(j_nonobject_const.at("foo"), json::type_error);
|
||||
CHECK_THROWS_AS(j_nonobject.at("foo"), json::type_error&);
|
||||
CHECK_THROWS_AS(j_nonobject_const.at("foo"), json::type_error&);
|
||||
CHECK_THROWS_WITH(j_nonobject.at("foo"), "[json.exception.type_error.304] cannot use at() with number");
|
||||
CHECK_THROWS_WITH(j_nonobject_const.at("foo"), "[json.exception.type_error.304] cannot use at() with number");
|
||||
}
|
||||
@ -202,8 +202,8 @@ TEST_CASE("element access 2")
|
||||
{
|
||||
json j_nonobject(json::value_t::null);
|
||||
const json j_nonobject_const(j_nonobject);
|
||||
CHECK_THROWS_AS(j_nonobject.value("foo", 1), json::type_error);
|
||||
CHECK_THROWS_AS(j_nonobject_const.value("foo", 1), json::type_error);
|
||||
CHECK_THROWS_AS(j_nonobject.value("foo", 1), json::type_error&);
|
||||
CHECK_THROWS_AS(j_nonobject_const.value("foo", 1), json::type_error&);
|
||||
CHECK_THROWS_WITH(j_nonobject.value("foo", 1),
|
||||
"[json.exception.type_error.306] cannot use value() with null");
|
||||
CHECK_THROWS_WITH(j_nonobject_const.value("foo", 1),
|
||||
@ -214,8 +214,8 @@ TEST_CASE("element access 2")
|
||||
{
|
||||
json j_nonobject(json::value_t::boolean);
|
||||
const json j_nonobject_const(j_nonobject);
|
||||
CHECK_THROWS_AS(j_nonobject.value("foo", 1), json::type_error);
|
||||
CHECK_THROWS_AS(j_nonobject_const.value("foo", 1), json::type_error);
|
||||
CHECK_THROWS_AS(j_nonobject.value("foo", 1), json::type_error&);
|
||||
CHECK_THROWS_AS(j_nonobject_const.value("foo", 1), json::type_error&);
|
||||
CHECK_THROWS_WITH(j_nonobject.value("foo", 1),
|
||||
"[json.exception.type_error.306] cannot use value() with boolean");
|
||||
CHECK_THROWS_WITH(j_nonobject_const.value("foo", 1),
|
||||
@ -226,8 +226,8 @@ TEST_CASE("element access 2")
|
||||
{
|
||||
json j_nonobject(json::value_t::string);
|
||||
const json j_nonobject_const(j_nonobject);
|
||||
CHECK_THROWS_AS(j_nonobject.value("foo", 1), json::type_error);
|
||||
CHECK_THROWS_AS(j_nonobject_const.value("foo", 1), json::type_error);
|
||||
CHECK_THROWS_AS(j_nonobject.value("foo", 1), json::type_error&);
|
||||
CHECK_THROWS_AS(j_nonobject_const.value("foo", 1), json::type_error&);
|
||||
CHECK_THROWS_WITH(j_nonobject.value("foo", 1),
|
||||
"[json.exception.type_error.306] cannot use value() with string");
|
||||
CHECK_THROWS_WITH(j_nonobject_const.value("foo", 1),
|
||||
@ -238,8 +238,8 @@ TEST_CASE("element access 2")
|
||||
{
|
||||
json j_nonobject(json::value_t::array);
|
||||
const json j_nonobject_const(j_nonobject);
|
||||
CHECK_THROWS_AS(j_nonobject.value("foo", 1), json::type_error);
|
||||
CHECK_THROWS_AS(j_nonobject_const.value("foo", 1), json::type_error);
|
||||
CHECK_THROWS_AS(j_nonobject.value("foo", 1), json::type_error&);
|
||||
CHECK_THROWS_AS(j_nonobject_const.value("foo", 1), json::type_error&);
|
||||
CHECK_THROWS_WITH(j_nonobject.value("foo", 1),
|
||||
"[json.exception.type_error.306] cannot use value() with array");
|
||||
CHECK_THROWS_WITH(j_nonobject_const.value("foo", 1),
|
||||
@ -250,8 +250,8 @@ TEST_CASE("element access 2")
|
||||
{
|
||||
json j_nonobject(json::value_t::number_integer);
|
||||
const json j_nonobject_const(j_nonobject);
|
||||
CHECK_THROWS_AS(j_nonobject.value("foo", 1), json::type_error);
|
||||
CHECK_THROWS_AS(j_nonobject_const.value("foo", 1), json::type_error);
|
||||
CHECK_THROWS_AS(j_nonobject.value("foo", 1), json::type_error&);
|
||||
CHECK_THROWS_AS(j_nonobject_const.value("foo", 1), json::type_error&);
|
||||
CHECK_THROWS_WITH(j_nonobject.value("foo", 1),
|
||||
"[json.exception.type_error.306] cannot use value() with number");
|
||||
CHECK_THROWS_WITH(j_nonobject_const.value("foo", 1),
|
||||
@ -262,8 +262,8 @@ TEST_CASE("element access 2")
|
||||
{
|
||||
json j_nonobject(json::value_t::number_unsigned);
|
||||
const json j_nonobject_const(j_nonobject);
|
||||
CHECK_THROWS_AS(j_nonobject.value("foo", 1), json::type_error);
|
||||
CHECK_THROWS_AS(j_nonobject_const.value("foo", 1), json::type_error);
|
||||
CHECK_THROWS_AS(j_nonobject.value("foo", 1), json::type_error&);
|
||||
CHECK_THROWS_AS(j_nonobject_const.value("foo", 1), json::type_error&);
|
||||
CHECK_THROWS_WITH(j_nonobject.value("foo", 1),
|
||||
"[json.exception.type_error.306] cannot use value() with number");
|
||||
CHECK_THROWS_WITH(j_nonobject_const.value("foo", 1),
|
||||
@ -274,8 +274,8 @@ TEST_CASE("element access 2")
|
||||
{
|
||||
json j_nonobject(json::value_t::number_float);
|
||||
const json j_nonobject_const(j_nonobject);
|
||||
CHECK_THROWS_AS(j_nonobject.value("foo", 1), json::type_error);
|
||||
CHECK_THROWS_AS(j_nonobject_const.value("foo", 1), json::type_error);
|
||||
CHECK_THROWS_AS(j_nonobject.value("foo", 1), json::type_error&);
|
||||
CHECK_THROWS_AS(j_nonobject_const.value("foo", 1), json::type_error&);
|
||||
CHECK_THROWS_WITH(j_nonobject.value("foo", 1),
|
||||
"[json.exception.type_error.306] cannot use value() with number");
|
||||
CHECK_THROWS_WITH(j_nonobject_const.value("foo", 1),
|
||||
@ -320,8 +320,8 @@ TEST_CASE("element access 2")
|
||||
{
|
||||
json j_nonobject(json::value_t::null);
|
||||
const json j_nonobject_const(j_nonobject);
|
||||
CHECK_THROWS_AS(j_nonobject.value("/foo"_json_pointer, 1), json::type_error);
|
||||
CHECK_THROWS_AS(j_nonobject_const.value("/foo"_json_pointer, 1), json::type_error);
|
||||
CHECK_THROWS_AS(j_nonobject.value("/foo"_json_pointer, 1), json::type_error&);
|
||||
CHECK_THROWS_AS(j_nonobject_const.value("/foo"_json_pointer, 1), json::type_error&);
|
||||
CHECK_THROWS_WITH(j_nonobject.value("/foo"_json_pointer, 1),
|
||||
"[json.exception.type_error.306] cannot use value() with null");
|
||||
CHECK_THROWS_WITH(j_nonobject_const.value("/foo"_json_pointer, 1),
|
||||
@ -332,8 +332,8 @@ TEST_CASE("element access 2")
|
||||
{
|
||||
json j_nonobject(json::value_t::boolean);
|
||||
const json j_nonobject_const(j_nonobject);
|
||||
CHECK_THROWS_AS(j_nonobject.value("/foo"_json_pointer, 1), json::type_error);
|
||||
CHECK_THROWS_AS(j_nonobject_const.value("/foo"_json_pointer, 1), json::type_error);
|
||||
CHECK_THROWS_AS(j_nonobject.value("/foo"_json_pointer, 1), json::type_error&);
|
||||
CHECK_THROWS_AS(j_nonobject_const.value("/foo"_json_pointer, 1), json::type_error&);
|
||||
CHECK_THROWS_WITH(j_nonobject.value("/foo"_json_pointer, 1),
|
||||
"[json.exception.type_error.306] cannot use value() with boolean");
|
||||
CHECK_THROWS_WITH(j_nonobject_const.value("/foo"_json_pointer, 1),
|
||||
@ -344,8 +344,8 @@ TEST_CASE("element access 2")
|
||||
{
|
||||
json j_nonobject(json::value_t::string);
|
||||
const json j_nonobject_const(j_nonobject);
|
||||
CHECK_THROWS_AS(j_nonobject.value("/foo"_json_pointer, 1), json::type_error);
|
||||
CHECK_THROWS_AS(j_nonobject_const.value("/foo"_json_pointer, 1), json::type_error);
|
||||
CHECK_THROWS_AS(j_nonobject.value("/foo"_json_pointer, 1), json::type_error&);
|
||||
CHECK_THROWS_AS(j_nonobject_const.value("/foo"_json_pointer, 1), json::type_error&);
|
||||
CHECK_THROWS_WITH(j_nonobject.value("/foo"_json_pointer, 1),
|
||||
"[json.exception.type_error.306] cannot use value() with string");
|
||||
CHECK_THROWS_WITH(j_nonobject_const.value("/foo"_json_pointer, 1),
|
||||
@ -356,8 +356,8 @@ TEST_CASE("element access 2")
|
||||
{
|
||||
json j_nonobject(json::value_t::array);
|
||||
const json j_nonobject_const(j_nonobject);
|
||||
CHECK_THROWS_AS(j_nonobject.value("/foo"_json_pointer, 1), json::type_error);
|
||||
CHECK_THROWS_AS(j_nonobject_const.value("/foo"_json_pointer, 1), json::type_error);
|
||||
CHECK_THROWS_AS(j_nonobject.value("/foo"_json_pointer, 1), json::type_error&);
|
||||
CHECK_THROWS_AS(j_nonobject_const.value("/foo"_json_pointer, 1), json::type_error&);
|
||||
CHECK_THROWS_WITH(j_nonobject.value("/foo"_json_pointer, 1),
|
||||
"[json.exception.type_error.306] cannot use value() with array");
|
||||
CHECK_THROWS_WITH(j_nonobject_const.value("/foo"_json_pointer, 1),
|
||||
@ -368,8 +368,8 @@ TEST_CASE("element access 2")
|
||||
{
|
||||
json j_nonobject(json::value_t::number_integer);
|
||||
const json j_nonobject_const(j_nonobject);
|
||||
CHECK_THROWS_AS(j_nonobject.value("/foo"_json_pointer, 1), json::type_error);
|
||||
CHECK_THROWS_AS(j_nonobject_const.value("/foo"_json_pointer, 1), json::type_error);
|
||||
CHECK_THROWS_AS(j_nonobject.value("/foo"_json_pointer, 1), json::type_error&);
|
||||
CHECK_THROWS_AS(j_nonobject_const.value("/foo"_json_pointer, 1), json::type_error&);
|
||||
CHECK_THROWS_WITH(j_nonobject.value("/foo"_json_pointer, 1),
|
||||
"[json.exception.type_error.306] cannot use value() with number");
|
||||
CHECK_THROWS_WITH(j_nonobject_const.value("/foo"_json_pointer, 1),
|
||||
@ -380,8 +380,8 @@ TEST_CASE("element access 2")
|
||||
{
|
||||
json j_nonobject(json::value_t::number_unsigned);
|
||||
const json j_nonobject_const(j_nonobject);
|
||||
CHECK_THROWS_AS(j_nonobject.value("/foo"_json_pointer, 1), json::type_error);
|
||||
CHECK_THROWS_AS(j_nonobject_const.value("/foo"_json_pointer, 1), json::type_error);
|
||||
CHECK_THROWS_AS(j_nonobject.value("/foo"_json_pointer, 1), json::type_error&);
|
||||
CHECK_THROWS_AS(j_nonobject_const.value("/foo"_json_pointer, 1), json::type_error&);
|
||||
CHECK_THROWS_WITH(j_nonobject.value("/foo"_json_pointer, 1),
|
||||
"[json.exception.type_error.306] cannot use value() with number");
|
||||
CHECK_THROWS_WITH(j_nonobject_const.value("/foo"_json_pointer, 1),
|
||||
@ -392,8 +392,8 @@ TEST_CASE("element access 2")
|
||||
{
|
||||
json j_nonobject(json::value_t::number_float);
|
||||
const json j_nonobject_const(j_nonobject);
|
||||
CHECK_THROWS_AS(j_nonobject.value("/foo"_json_pointer, 1), json::type_error);
|
||||
CHECK_THROWS_AS(j_nonobject_const.value("/foo"_json_pointer, 1), json::type_error);
|
||||
CHECK_THROWS_AS(j_nonobject.value("/foo"_json_pointer, 1), json::type_error&);
|
||||
CHECK_THROWS_AS(j_nonobject_const.value("/foo"_json_pointer, 1), json::type_error&);
|
||||
CHECK_THROWS_WITH(j_nonobject.value("/foo"_json_pointer, 1),
|
||||
"[json.exception.type_error.306] cannot use value() with number");
|
||||
CHECK_THROWS_WITH(j_nonobject_const.value("/foo"_json_pointer, 1),
|
||||
@ -472,8 +472,8 @@ TEST_CASE("element access 2")
|
||||
const json j_const_nonobject(j_nonobject);
|
||||
CHECK_NOTHROW(j_nonobject["foo"]);
|
||||
CHECK_NOTHROW(j_nonobject2[json::object_t::key_type("foo")]);
|
||||
CHECK_THROWS_AS(j_const_nonobject["foo"], json::type_error);
|
||||
CHECK_THROWS_AS(j_const_nonobject[json::object_t::key_type("foo")], json::type_error);
|
||||
CHECK_THROWS_AS(j_const_nonobject["foo"], json::type_error&);
|
||||
CHECK_THROWS_AS(j_const_nonobject[json::object_t::key_type("foo")], json::type_error&);
|
||||
CHECK_THROWS_WITH(j_const_nonobject["foo"], "[json.exception.type_error.305] cannot use operator[] with null");
|
||||
CHECK_THROWS_WITH(j_const_nonobject[json::object_t::key_type("foo")],
|
||||
"[json.exception.type_error.305] cannot use operator[] with null");
|
||||
@ -483,10 +483,10 @@ TEST_CASE("element access 2")
|
||||
{
|
||||
json j_nonobject(json::value_t::boolean);
|
||||
const json j_const_nonobject(j_nonobject);
|
||||
CHECK_THROWS_AS(j_nonobject["foo"], json::type_error);
|
||||
CHECK_THROWS_AS(j_nonobject[json::object_t::key_type("foo")], json::type_error);
|
||||
CHECK_THROWS_AS(j_const_nonobject["foo"], json::type_error);
|
||||
CHECK_THROWS_AS(j_const_nonobject[json::object_t::key_type("foo")], json::type_error);
|
||||
CHECK_THROWS_AS(j_nonobject["foo"], json::type_error&);
|
||||
CHECK_THROWS_AS(j_nonobject[json::object_t::key_type("foo")], json::type_error&);
|
||||
CHECK_THROWS_AS(j_const_nonobject["foo"], json::type_error&);
|
||||
CHECK_THROWS_AS(j_const_nonobject[json::object_t::key_type("foo")], json::type_error&);
|
||||
CHECK_THROWS_WITH(j_nonobject["foo"],
|
||||
"[json.exception.type_error.305] cannot use operator[] with boolean");
|
||||
CHECK_THROWS_WITH(j_nonobject[json::object_t::key_type("foo")],
|
||||
@ -501,10 +501,10 @@ TEST_CASE("element access 2")
|
||||
{
|
||||
json j_nonobject(json::value_t::string);
|
||||
const json j_const_nonobject(j_nonobject);
|
||||
CHECK_THROWS_AS(j_nonobject["foo"], json::type_error);
|
||||
CHECK_THROWS_AS(j_nonobject[json::object_t::key_type("foo")], json::type_error);
|
||||
CHECK_THROWS_AS(j_const_nonobject["foo"], json::type_error);
|
||||
CHECK_THROWS_AS(j_const_nonobject[json::object_t::key_type("foo")], json::type_error);
|
||||
CHECK_THROWS_AS(j_nonobject["foo"], json::type_error&);
|
||||
CHECK_THROWS_AS(j_nonobject[json::object_t::key_type("foo")], json::type_error&);
|
||||
CHECK_THROWS_AS(j_const_nonobject["foo"], json::type_error&);
|
||||
CHECK_THROWS_AS(j_const_nonobject[json::object_t::key_type("foo")], json::type_error&);
|
||||
CHECK_THROWS_WITH(j_nonobject["foo"],
|
||||
"[json.exception.type_error.305] cannot use operator[] with string");
|
||||
CHECK_THROWS_WITH(j_nonobject[json::object_t::key_type("foo")],
|
||||
@ -519,10 +519,10 @@ TEST_CASE("element access 2")
|
||||
{
|
||||
json j_nonobject(json::value_t::array);
|
||||
const json j_const_nonobject(j_nonobject);
|
||||
CHECK_THROWS_AS(j_nonobject["foo"], json::type_error);
|
||||
CHECK_THROWS_AS(j_nonobject[json::object_t::key_type("foo")], json::type_error);
|
||||
CHECK_THROWS_AS(j_const_nonobject["foo"], json::type_error);
|
||||
CHECK_THROWS_AS(j_const_nonobject[json::object_t::key_type("foo")], json::type_error);
|
||||
CHECK_THROWS_AS(j_nonobject["foo"], json::type_error&);
|
||||
CHECK_THROWS_AS(j_nonobject[json::object_t::key_type("foo")], json::type_error&);
|
||||
CHECK_THROWS_AS(j_const_nonobject["foo"], json::type_error&);
|
||||
CHECK_THROWS_AS(j_const_nonobject[json::object_t::key_type("foo")], json::type_error&);
|
||||
CHECK_THROWS_WITH(j_nonobject["foo"],
|
||||
"[json.exception.type_error.305] cannot use operator[] with array");
|
||||
CHECK_THROWS_WITH(j_nonobject[json::object_t::key_type("foo")], "[json.exception.type_error.305] cannot use operator[] with array");
|
||||
@ -536,10 +536,10 @@ TEST_CASE("element access 2")
|
||||
{
|
||||
json j_nonobject(json::value_t::number_integer);
|
||||
const json j_const_nonobject(j_nonobject);
|
||||
CHECK_THROWS_AS(j_nonobject["foo"], json::type_error);
|
||||
CHECK_THROWS_AS(j_nonobject[json::object_t::key_type("foo")], json::type_error);
|
||||
CHECK_THROWS_AS(j_const_nonobject["foo"], json::type_error);
|
||||
CHECK_THROWS_AS(j_const_nonobject[json::object_t::key_type("foo")], json::type_error);
|
||||
CHECK_THROWS_AS(j_nonobject["foo"], json::type_error&);
|
||||
CHECK_THROWS_AS(j_nonobject[json::object_t::key_type("foo")], json::type_error&);
|
||||
CHECK_THROWS_AS(j_const_nonobject["foo"], json::type_error&);
|
||||
CHECK_THROWS_AS(j_const_nonobject[json::object_t::key_type("foo")], json::type_error&);
|
||||
CHECK_THROWS_WITH(j_nonobject["foo"],
|
||||
"[json.exception.type_error.305] cannot use operator[] with number");
|
||||
CHECK_THROWS_WITH(j_nonobject[json::object_t::key_type("foo")],
|
||||
@ -554,10 +554,10 @@ TEST_CASE("element access 2")
|
||||
{
|
||||
json j_nonobject(json::value_t::number_unsigned);
|
||||
const json j_const_nonobject(j_nonobject);
|
||||
CHECK_THROWS_AS(j_nonobject["foo"], json::type_error);
|
||||
CHECK_THROWS_AS(j_nonobject[json::object_t::key_type("foo")], json::type_error);
|
||||
CHECK_THROWS_AS(j_const_nonobject["foo"], json::type_error);
|
||||
CHECK_THROWS_AS(j_const_nonobject[json::object_t::key_type("foo")], json::type_error);
|
||||
CHECK_THROWS_AS(j_nonobject["foo"], json::type_error&);
|
||||
CHECK_THROWS_AS(j_nonobject[json::object_t::key_type("foo")], json::type_error&);
|
||||
CHECK_THROWS_AS(j_const_nonobject["foo"], json::type_error&);
|
||||
CHECK_THROWS_AS(j_const_nonobject[json::object_t::key_type("foo")], json::type_error&);
|
||||
CHECK_THROWS_WITH(j_nonobject["foo"],
|
||||
"[json.exception.type_error.305] cannot use operator[] with number");
|
||||
CHECK_THROWS_WITH(j_nonobject[json::object_t::key_type("foo")],
|
||||
@ -572,10 +572,10 @@ TEST_CASE("element access 2")
|
||||
{
|
||||
json j_nonobject(json::value_t::number_float);
|
||||
const json j_const_nonobject(j_nonobject);
|
||||
CHECK_THROWS_AS(j_nonobject["foo"], json::type_error);
|
||||
CHECK_THROWS_AS(j_nonobject[json::object_t::key_type("foo")], json::type_error);
|
||||
CHECK_THROWS_AS(j_const_nonobject["foo"], json::type_error);
|
||||
CHECK_THROWS_AS(j_const_nonobject[json::object_t::key_type("foo")], json::type_error);
|
||||
CHECK_THROWS_AS(j_nonobject["foo"], json::type_error&);
|
||||
CHECK_THROWS_AS(j_nonobject[json::object_t::key_type("foo")], json::type_error&);
|
||||
CHECK_THROWS_AS(j_const_nonobject["foo"], json::type_error&);
|
||||
CHECK_THROWS_AS(j_const_nonobject[json::object_t::key_type("foo")], json::type_error&);
|
||||
CHECK_THROWS_WITH(j_nonobject["foo"],
|
||||
"[json.exception.type_error.305] cannot use operator[] with number");
|
||||
CHECK_THROWS_WITH(j_nonobject[json::object_t::key_type("foo")],
|
||||
@ -722,10 +722,10 @@ TEST_CASE("element access 2")
|
||||
{
|
||||
json jobject = {{"a", "a"}, {"b", 1}, {"c", 17u}, {"d", false}, {"e", true}};
|
||||
json jobject2 = {{"a", "a"}, {"b", 1}, {"c", 17u}};
|
||||
CHECK_THROWS_AS(jobject.erase(jobject2.begin()), json::invalid_iterator);
|
||||
CHECK_THROWS_AS(jobject.erase(jobject.begin(), jobject2.end()), json::invalid_iterator);
|
||||
CHECK_THROWS_AS(jobject.erase(jobject2.begin(), jobject.end()), json::invalid_iterator);
|
||||
CHECK_THROWS_AS(jobject.erase(jobject2.begin(), jobject2.end()), json::invalid_iterator);
|
||||
CHECK_THROWS_AS(jobject.erase(jobject2.begin()), json::invalid_iterator&);
|
||||
CHECK_THROWS_AS(jobject.erase(jobject.begin(), jobject2.end()), json::invalid_iterator&);
|
||||
CHECK_THROWS_AS(jobject.erase(jobject2.begin(), jobject.end()), json::invalid_iterator&);
|
||||
CHECK_THROWS_AS(jobject.erase(jobject2.begin(), jobject2.end()), json::invalid_iterator&);
|
||||
CHECK_THROWS_WITH(jobject.erase(jobject2.begin()),
|
||||
"[json.exception.invalid_iterator.202] iterator does not fit current value");
|
||||
CHECK_THROWS_WITH(jobject.erase(jobject.begin(), jobject2.end()),
|
||||
@ -738,10 +738,10 @@ TEST_CASE("element access 2")
|
||||
{
|
||||
json jobject = {{"a", "a"}, {"b", 1}, {"c", 17u}, {"d", false}, {"e", true}};
|
||||
json jobject2 = {{"a", "a"}, {"b", 1}, {"c", 17u}};
|
||||
CHECK_THROWS_AS(jobject.erase(jobject2.cbegin()), json::invalid_iterator);
|
||||
CHECK_THROWS_AS(jobject.erase(jobject.cbegin(), jobject2.cend()), json::invalid_iterator);
|
||||
CHECK_THROWS_AS(jobject.erase(jobject2.cbegin(), jobject.cend()), json::invalid_iterator);
|
||||
CHECK_THROWS_AS(jobject.erase(jobject2.cbegin(), jobject2.cend()), json::invalid_iterator);
|
||||
CHECK_THROWS_AS(jobject.erase(jobject2.cbegin()), json::invalid_iterator&);
|
||||
CHECK_THROWS_AS(jobject.erase(jobject.cbegin(), jobject2.cend()), json::invalid_iterator&);
|
||||
CHECK_THROWS_AS(jobject.erase(jobject2.cbegin(), jobject.cend()), json::invalid_iterator&);
|
||||
CHECK_THROWS_AS(jobject.erase(jobject2.cbegin(), jobject2.cend()), json::invalid_iterator&);
|
||||
CHECK_THROWS_WITH(jobject.erase(jobject2.cbegin()),
|
||||
"[json.exception.invalid_iterator.202] iterator does not fit current value");
|
||||
CHECK_THROWS_WITH(jobject.erase(jobject.cbegin(), jobject2.cend()),
|
||||
@ -759,7 +759,7 @@ TEST_CASE("element access 2")
|
||||
SECTION("null")
|
||||
{
|
||||
json j_nonobject(json::value_t::null);
|
||||
CHECK_THROWS_AS(j_nonobject.erase("foo"), json::type_error);
|
||||
CHECK_THROWS_AS(j_nonobject.erase("foo"), json::type_error&);
|
||||
CHECK_THROWS_WITH(j_nonobject.erase("foo"),
|
||||
"[json.exception.type_error.307] cannot use erase() with null");
|
||||
}
|
||||
@ -767,7 +767,7 @@ TEST_CASE("element access 2")
|
||||
SECTION("boolean")
|
||||
{
|
||||
json j_nonobject(json::value_t::boolean);
|
||||
CHECK_THROWS_AS(j_nonobject.erase("foo"), json::type_error);
|
||||
CHECK_THROWS_AS(j_nonobject.erase("foo"), json::type_error&);
|
||||
CHECK_THROWS_WITH(j_nonobject.erase("foo"),
|
||||
"[json.exception.type_error.307] cannot use erase() with boolean");
|
||||
}
|
||||
@ -775,7 +775,7 @@ TEST_CASE("element access 2")
|
||||
SECTION("string")
|
||||
{
|
||||
json j_nonobject(json::value_t::string);
|
||||
CHECK_THROWS_AS(j_nonobject.erase("foo"), json::type_error);
|
||||
CHECK_THROWS_AS(j_nonobject.erase("foo"), json::type_error&);
|
||||
CHECK_THROWS_WITH(j_nonobject.erase("foo"),
|
||||
"[json.exception.type_error.307] cannot use erase() with string");
|
||||
}
|
||||
@ -783,7 +783,7 @@ TEST_CASE("element access 2")
|
||||
SECTION("array")
|
||||
{
|
||||
json j_nonobject(json::value_t::array);
|
||||
CHECK_THROWS_AS(j_nonobject.erase("foo"), json::type_error);
|
||||
CHECK_THROWS_AS(j_nonobject.erase("foo"), json::type_error&);
|
||||
CHECK_THROWS_WITH(j_nonobject.erase("foo"),
|
||||
"[json.exception.type_error.307] cannot use erase() with array");
|
||||
}
|
||||
@ -791,7 +791,7 @@ TEST_CASE("element access 2")
|
||||
SECTION("number (integer)")
|
||||
{
|
||||
json j_nonobject(json::value_t::number_integer);
|
||||
CHECK_THROWS_AS(j_nonobject.erase("foo"), json::type_error);
|
||||
CHECK_THROWS_AS(j_nonobject.erase("foo"), json::type_error&);
|
||||
CHECK_THROWS_WITH(j_nonobject.erase("foo"),
|
||||
"[json.exception.type_error.307] cannot use erase() with number");
|
||||
}
|
||||
@ -799,7 +799,7 @@ TEST_CASE("element access 2")
|
||||
SECTION("number (floating-point)")
|
||||
{
|
||||
json j_nonobject(json::value_t::number_float);
|
||||
CHECK_THROWS_AS(j_nonobject.erase("foo"), json::type_error);
|
||||
CHECK_THROWS_AS(j_nonobject.erase("foo"), json::type_error&);
|
||||
CHECK_THROWS_WITH(j_nonobject.erase("foo"),
|
||||
"[json.exception.type_error.307] cannot use erase() with number");
|
||||
}
|
||||
|
Reference in New Issue
Block a user