From 814046621767a8d7e84164a935d6659fff465348 Mon Sep 17 00:00:00 2001 From: Krzysiek Karbowiak Date: Thu, 17 Mar 2022 10:38:16 +0100 Subject: [PATCH] Refactor assertions in unit-conversions.cpp --- test/src/unit-conversions.cpp | 388 ++++++++++++---------------------- 1 file changed, 134 insertions(+), 254 deletions(-) diff --git a/test/src/unit-conversions.cpp b/test/src/unit-conversions.cpp index 092d5b8c3..df1dbf972 100644 --- a/test/src/unit-conversions.cpp +++ b/test/src/unit-conversions.cpp @@ -101,43 +101,27 @@ TEST_CASE("value conversion") SECTION("exception in case of a non-object type") { - CHECK_THROWS_AS(json(json::value_t::null).get(), - json::type_error&); - CHECK_THROWS_AS(json(json::value_t::array).get(), - json::type_error&); - CHECK_THROWS_AS(json(json::value_t::string).get(), - json::type_error&); - CHECK_THROWS_AS(json(json::value_t::boolean).get(), - json::type_error&); - CHECK_THROWS_AS(json(json::value_t::number_integer).get(), - json::type_error&); - CHECK_THROWS_AS( - json(json::value_t::number_unsigned).get(), - json::type_error&); - CHECK_THROWS_AS(json(json::value_t::number_float).get(), - json::type_error&); - - CHECK_THROWS_WITH( + CHECK_THROWS_WITH_AS( json(json::value_t::null).get(), - "[json.exception.type_error.302] type must be object, but is null"); - CHECK_THROWS_WITH( + "[json.exception.type_error.302] type must be object, but is null", json::type_error&); + CHECK_THROWS_WITH_AS( json(json::value_t::array).get(), - "[json.exception.type_error.302] type must be object, but is array"); - CHECK_THROWS_WITH( + "[json.exception.type_error.302] type must be object, but is array", json::type_error&); + CHECK_THROWS_WITH_AS( json(json::value_t::string).get(), - "[json.exception.type_error.302] type must be object, but is string"); - CHECK_THROWS_WITH(json(json::value_t::boolean).get(), + "[json.exception.type_error.302] type must be object, but is string", json::type_error&); + CHECK_THROWS_WITH_AS(json(json::value_t::boolean).get(), "[json.exception.type_error.302] type must be object, " - "but is boolean"); - CHECK_THROWS_WITH( + "but is boolean", json::type_error&); + CHECK_THROWS_WITH_AS( json(json::value_t::number_integer).get(), - "[json.exception.type_error.302] type must be object, but is number"); - CHECK_THROWS_WITH( + "[json.exception.type_error.302] type must be object, but is number", json::type_error&); + CHECK_THROWS_WITH_AS( json(json::value_t::number_unsigned).get(), - "[json.exception.type_error.302] type must be object, but is number"); - CHECK_THROWS_WITH( + "[json.exception.type_error.302] type must be object, but is number", json::type_error&); + CHECK_THROWS_WITH_AS( json(json::value_t::number_float).get(), - "[json.exception.type_error.302] type must be object, but is number"); + "[json.exception.type_error.302] type must be object, but is number", json::type_error&); } } @@ -255,11 +239,9 @@ TEST_CASE("value conversion") std::forward_list a = j.get>(); CHECK(json(a) == j); - CHECK_THROWS_AS(json(json::value_t::null).get>(), - json::type_error&); - CHECK_THROWS_WITH( + CHECK_THROWS_WITH_AS( json(json::value_t::null).get>(), - "[json.exception.type_error.302] type must be array, but is null"); + "[json.exception.type_error.302] type must be array, but is null", json::type_error&); } SECTION("std::vector") @@ -267,11 +249,9 @@ TEST_CASE("value conversion") std::vector a = j.get>(); CHECK(json(a) == j); - CHECK_THROWS_AS(json(json::value_t::null).get>(), - json::type_error&); - CHECK_THROWS_WITH( + CHECK_THROWS_WITH_AS( json(json::value_t::null).get>(), - "[json.exception.type_error.302] type must be array, but is null"); + "[json.exception.type_error.302] type must be array, but is null", json::type_error&); #if !defined(JSON_NOEXCEPTION) SECTION("reserve is called on containers that supports it") @@ -306,45 +286,30 @@ TEST_CASE("value conversion") SECTION("exception in case of a non-array type") { - CHECK_THROWS_AS(json(json::value_t::null).get(), - json::type_error&); - CHECK_THROWS_AS(json(json::value_t::object).get(), - json::type_error&); - CHECK_THROWS_AS(json(json::value_t::string).get(), - json::type_error&); - CHECK_THROWS_AS(json(json::value_t::boolean).get(), - json::type_error&); - CHECK_THROWS_AS(json(json::value_t::number_integer).get(), - json::type_error&); - CHECK_THROWS_AS(json(json::value_t::number_unsigned).get(), - json::type_error&); - CHECK_THROWS_AS(json(json::value_t::number_float).get(), - json::type_error&); - - CHECK_THROWS_WITH( + CHECK_THROWS_WITH_AS( json(json::value_t::object).get>(), - "[json.exception.type_error.302] type must be array, but is object"); - CHECK_THROWS_WITH( + "[json.exception.type_error.302] type must be array, but is object", json::type_error&); + CHECK_THROWS_WITH_AS( json(json::value_t::null).get(), - "[json.exception.type_error.302] type must be array, but is null"); - CHECK_THROWS_WITH( + "[json.exception.type_error.302] type must be array, but is null", json::type_error&); + CHECK_THROWS_WITH_AS( json(json::value_t::object).get(), - "[json.exception.type_error.302] type must be array, but is object"); - CHECK_THROWS_WITH( + "[json.exception.type_error.302] type must be array, but is object", json::type_error&); + CHECK_THROWS_WITH_AS( json(json::value_t::string).get(), - "[json.exception.type_error.302] type must be array, but is string"); - CHECK_THROWS_WITH( + "[json.exception.type_error.302] type must be array, but is string", json::type_error&); + CHECK_THROWS_WITH_AS( json(json::value_t::boolean).get(), - "[json.exception.type_error.302] type must be array, but is boolean"); - CHECK_THROWS_WITH( + "[json.exception.type_error.302] type must be array, but is boolean", json::type_error&); + CHECK_THROWS_WITH_AS( json(json::value_t::number_integer).get(), - "[json.exception.type_error.302] type must be array, but is number"); - CHECK_THROWS_WITH( + "[json.exception.type_error.302] type must be array, but is number", json::type_error&); + CHECK_THROWS_WITH_AS( json(json::value_t::number_unsigned).get(), - "[json.exception.type_error.302] type must be array, but is number"); - CHECK_THROWS_WITH( + "[json.exception.type_error.302] type must be array, but is number", json::type_error&); + CHECK_THROWS_WITH_AS( json(json::value_t::number_float).get(), - "[json.exception.type_error.302] type must be array, but is number"); + "[json.exception.type_error.302] type must be array, but is number", json::type_error&); } } @@ -472,70 +437,46 @@ TEST_CASE("value conversion") SECTION("exception in case of a non-string type") { - CHECK_THROWS_AS(json(json::value_t::null).get(), - json::type_error&); - CHECK_THROWS_AS(json(json::value_t::object).get(), - json::type_error&); - CHECK_THROWS_AS(json(json::value_t::array).get(), - json::type_error&); - CHECK_THROWS_AS(json(json::value_t::boolean).get(), - json::type_error&); - CHECK_THROWS_AS(json(json::value_t::number_integer).get(), - json::type_error&); - CHECK_THROWS_AS( - json(json::value_t::number_unsigned).get(), - json::type_error&); - CHECK_THROWS_AS(json(json::value_t::number_float).get(), - json::type_error&); - - CHECK_THROWS_WITH( + CHECK_THROWS_WITH_AS( json(json::value_t::null).get(), - "[json.exception.type_error.302] type must be string, but is null"); - CHECK_THROWS_WITH( + "[json.exception.type_error.302] type must be string, but is null", json::type_error&); + CHECK_THROWS_WITH_AS( json(json::value_t::object).get(), - "[json.exception.type_error.302] type must be string, but is object"); - CHECK_THROWS_WITH( + "[json.exception.type_error.302] type must be string, but is object", json::type_error&); + CHECK_THROWS_WITH_AS( json(json::value_t::array).get(), - "[json.exception.type_error.302] type must be string, but is array"); - CHECK_THROWS_WITH(json(json::value_t::boolean).get(), + "[json.exception.type_error.302] type must be string, but is array", json::type_error&); + CHECK_THROWS_WITH_AS(json(json::value_t::boolean).get(), "[json.exception.type_error.302] type must be string, " - "but is boolean"); - CHECK_THROWS_WITH( + "but is boolean", json::type_error&); + CHECK_THROWS_WITH_AS( json(json::value_t::number_integer).get(), - "[json.exception.type_error.302] type must be string, but is number"); - CHECK_THROWS_WITH( + "[json.exception.type_error.302] type must be string, but is number", json::type_error&); + CHECK_THROWS_WITH_AS( json(json::value_t::number_unsigned).get(), - "[json.exception.type_error.302] type must be string, but is number"); - CHECK_THROWS_WITH( + "[json.exception.type_error.302] type must be string, but is number", json::type_error&); + CHECK_THROWS_WITH_AS( json(json::value_t::number_float).get(), - "[json.exception.type_error.302] type must be string, but is number"); + "[json.exception.type_error.302] type must be string, but is number", json::type_error&); } #if defined(JSON_HAS_CPP_17) SECTION("exception in case of a non-string type using string_view") { - CHECK_THROWS_AS(json(json::value_t::null).get(), json::type_error&); - CHECK_THROWS_AS(json(json::value_t::object).get(), json::type_error&); - CHECK_THROWS_AS(json(json::value_t::array).get(), json::type_error&); - CHECK_THROWS_AS(json(json::value_t::boolean).get(), json::type_error&); - CHECK_THROWS_AS(json(json::value_t::number_integer).get(), json::type_error&); - CHECK_THROWS_AS(json(json::value_t::number_unsigned).get(), json::type_error&); - CHECK_THROWS_AS(json(json::value_t::number_float).get(), json::type_error&); - - CHECK_THROWS_WITH(json(json::value_t::null).get(), - "[json.exception.type_error.302] type must be string, but is null"); - CHECK_THROWS_WITH(json(json::value_t::object).get(), - "[json.exception.type_error.302] type must be string, but is object"); - CHECK_THROWS_WITH(json(json::value_t::array).get(), - "[json.exception.type_error.302] type must be string, but is array"); - CHECK_THROWS_WITH(json(json::value_t::boolean).get(), - "[json.exception.type_error.302] type must be string, but is boolean"); - CHECK_THROWS_WITH(json(json::value_t::number_integer).get(), - "[json.exception.type_error.302] type must be string, but is number"); - CHECK_THROWS_WITH(json(json::value_t::number_unsigned).get(), - "[json.exception.type_error.302] type must be string, but is number"); - CHECK_THROWS_WITH(json(json::value_t::number_float).get(), - "[json.exception.type_error.302] type must be string, but is number"); + CHECK_THROWS_WITH_AS(json(json::value_t::null).get(), + "[json.exception.type_error.302] type must be string, but is null", json::type_error&); + CHECK_THROWS_WITH_AS(json(json::value_t::object).get(), + "[json.exception.type_error.302] type must be string, but is object", json::type_error&); + CHECK_THROWS_WITH_AS(json(json::value_t::array).get(), + "[json.exception.type_error.302] type must be string, but is array", json::type_error&); + CHECK_THROWS_WITH_AS(json(json::value_t::boolean).get(), + "[json.exception.type_error.302] type must be string, but is boolean", json::type_error&); + CHECK_THROWS_WITH_AS(json(json::value_t::number_integer).get(), + "[json.exception.type_error.302] type must be string, but is number", json::type_error&); + CHECK_THROWS_WITH_AS(json(json::value_t::number_unsigned).get(), + "[json.exception.type_error.302] type must be string, but is number", json::type_error&); + CHECK_THROWS_WITH_AS(json(json::value_t::number_float).get(), + "[json.exception.type_error.302] type must be string, but is number", json::type_error&); } #endif } @@ -577,29 +518,20 @@ TEST_CASE("value conversion") auto n2 = j.get(); CHECK(n2 == n); - CHECK_THROWS_AS(json(json::value_t::string).get(), json::type_error&); - CHECK_THROWS_AS(json(json::value_t::object).get(), json::type_error&); - CHECK_THROWS_AS(json(json::value_t::array).get(), json::type_error&); - CHECK_THROWS_AS(json(json::value_t::boolean).get(), json::type_error&); - CHECK_THROWS_AS(json(json::value_t::number_integer).get(), json::type_error&); - CHECK_THROWS_AS(json(json::value_t::number_unsigned).get(), json::type_error&); - CHECK_THROWS_AS(json(json::value_t::number_float).get(), json::type_error&); - - CHECK_THROWS_WITH(json(json::value_t::string).get(), - "[json.exception.type_error.302] type must be null, but is string"); - CHECK_THROWS_WITH(json(json::value_t::object).get(), - "[json.exception.type_error.302] type must be null, but is object"); - CHECK_THROWS_WITH(json(json::value_t::array).get(), - "[json.exception.type_error.302] type must be null, but is array"); - CHECK_THROWS_WITH(json(json::value_t::boolean).get(), - "[json.exception.type_error.302] type must be null, but is boolean"); - CHECK_THROWS_WITH(json(json::value_t::number_integer).get(), - "[json.exception.type_error.302] type must be null, but is number"); - CHECK_THROWS_WITH(json(json::value_t::number_unsigned).get(), - "[json.exception.type_error.302] type must be null, but is number"); - CHECK_THROWS_WITH(json(json::value_t::number_float).get(), - "[json.exception.type_error.302] type must be null, but is number"); - + CHECK_THROWS_WITH_AS(json(json::value_t::string).get(), + "[json.exception.type_error.302] type must be null, but is string", json::type_error&); + CHECK_THROWS_WITH_AS(json(json::value_t::object).get(), + "[json.exception.type_error.302] type must be null, but is object", json::type_error&); + CHECK_THROWS_WITH_AS(json(json::value_t::array).get(), + "[json.exception.type_error.302] type must be null, but is array", json::type_error&); + CHECK_THROWS_WITH_AS(json(json::value_t::boolean).get(), + "[json.exception.type_error.302] type must be null, but is boolean", json::type_error&); + CHECK_THROWS_WITH_AS(json(json::value_t::number_integer).get(), + "[json.exception.type_error.302] type must be null, but is number", json::type_error&); + CHECK_THROWS_WITH_AS(json(json::value_t::number_unsigned).get(), + "[json.exception.type_error.302] type must be null, but is number", json::type_error&); + CHECK_THROWS_WITH_AS(json(json::value_t::number_float).get(), + "[json.exception.type_error.302] type must be null, but is number", json::type_error&); } #if JSON_USE_IMPLICIT_CONVERSIONS @@ -655,49 +587,33 @@ TEST_CASE("value conversion") SECTION("exception in case of a non-number type") { - CHECK_THROWS_AS(json(json::value_t::null).get(), - json::type_error&); - CHECK_THROWS_AS(json(json::value_t::object).get(), - json::type_error&); - CHECK_THROWS_AS(json(json::value_t::array).get(), - json::type_error&); - CHECK_THROWS_AS(json(json::value_t::string).get(), - json::type_error&); CHECK_THROWS_AS(json(json::value_t::string).get(), json::type_error&); - CHECK_THROWS_AS( - json(json::value_t::number_integer).get(), - json::type_error&); - CHECK_THROWS_AS( - json(json::value_t::number_unsigned).get(), - json::type_error&); - CHECK_THROWS_AS(json(json::value_t::number_float).get(), - json::type_error&); - CHECK_THROWS_WITH( + CHECK_THROWS_WITH_AS( json(json::value_t::null).get(), - "[json.exception.type_error.302] type must be boolean, but is null"); - CHECK_THROWS_WITH(json(json::value_t::object).get(), + "[json.exception.type_error.302] type must be boolean, but is null", json::type_error&); + CHECK_THROWS_WITH_AS(json(json::value_t::object).get(), "[json.exception.type_error.302] type must be boolean, " - "but is object"); - CHECK_THROWS_WITH( + "but is object", json::type_error&); + CHECK_THROWS_WITH_AS( json(json::value_t::array).get(), - "[json.exception.type_error.302] type must be boolean, but is array"); - CHECK_THROWS_WITH(json(json::value_t::string).get(), + "[json.exception.type_error.302] type must be boolean, but is array", json::type_error&); + CHECK_THROWS_WITH_AS(json(json::value_t::string).get(), "[json.exception.type_error.302] type must be boolean, " - "but is string"); - CHECK_THROWS_WITH( + "but is string", json::type_error&); + CHECK_THROWS_WITH_AS( json(json::value_t::number_integer).get(), "[json.exception.type_error.302] type must be boolean, but is " - "number"); - CHECK_THROWS_WITH( + "number", json::type_error&); + CHECK_THROWS_WITH_AS( json(json::value_t::number_unsigned).get(), "[json.exception.type_error.302] type must be boolean, but is " - "number"); - CHECK_THROWS_WITH( + "number", json::type_error&); + CHECK_THROWS_WITH_AS( json(json::value_t::number_float).get(), "[json.exception.type_error.302] type must be boolean, but is " - "number"); + "number", json::type_error&); } } @@ -934,34 +850,22 @@ TEST_CASE("value conversion") SECTION("exception in case of a non-number type") { - CHECK_THROWS_AS(json(json::value_t::null).get(), - json::type_error&); - CHECK_THROWS_AS(json(json::value_t::object).get(), - json::type_error&); - CHECK_THROWS_AS(json(json::value_t::array).get(), - json::type_error&); - CHECK_THROWS_AS(json(json::value_t::string).get(), - json::type_error&); - CHECK_THROWS_AS( - json(json::value_t::boolean).get(), - json::type_error&); - - CHECK_THROWS_WITH( + CHECK_THROWS_WITH_AS( json(json::value_t::null).get(), - "[json.exception.type_error.302] type must be number, but is null"); - CHECK_THROWS_WITH( + "[json.exception.type_error.302] type must be number, but is null", json::type_error&); + CHECK_THROWS_WITH_AS( json(json::value_t::object).get(), - "[json.exception.type_error.302] type must be number, but is object"); - CHECK_THROWS_WITH( + "[json.exception.type_error.302] type must be number, but is object", json::type_error&); + CHECK_THROWS_WITH_AS( json(json::value_t::array).get(), - "[json.exception.type_error.302] type must be number, but is array"); - CHECK_THROWS_WITH( + "[json.exception.type_error.302] type must be number, but is array", json::type_error&); + CHECK_THROWS_WITH_AS( json(json::value_t::string).get(), - "[json.exception.type_error.302] type must be number, but is string"); - CHECK_THROWS_WITH( + "[json.exception.type_error.302] type must be number, but is string", json::type_error&); + CHECK_THROWS_WITH_AS( json(json::value_t::boolean).get(), "[json.exception.type_error.302] type must be number, but is " - "boolean"); + "boolean", json::type_error&); CHECK_NOTHROW( json(json::value_t::number_float).get()); @@ -1209,33 +1113,22 @@ TEST_CASE("value conversion") SECTION("exception in case of a non-string type") { - CHECK_THROWS_AS(json(json::value_t::null).get(), - json::type_error&); - CHECK_THROWS_AS(json(json::value_t::object).get(), - json::type_error&); - CHECK_THROWS_AS(json(json::value_t::array).get(), - json::type_error&); - CHECK_THROWS_AS(json(json::value_t::string).get(), - json::type_error&); - CHECK_THROWS_AS(json(json::value_t::boolean).get(), - json::type_error&); - - CHECK_THROWS_WITH( + CHECK_THROWS_WITH_AS( json(json::value_t::null).get(), - "[json.exception.type_error.302] type must be number, but is null"); - CHECK_THROWS_WITH( + "[json.exception.type_error.302] type must be number, but is null", json::type_error&); + CHECK_THROWS_WITH_AS( json(json::value_t::object).get(), - "[json.exception.type_error.302] type must be number, but is object"); - CHECK_THROWS_WITH( + "[json.exception.type_error.302] type must be number, but is object", json::type_error&); + CHECK_THROWS_WITH_AS( json(json::value_t::array).get(), - "[json.exception.type_error.302] type must be number, but is array"); - CHECK_THROWS_WITH( + "[json.exception.type_error.302] type must be number, but is array", json::type_error&); + CHECK_THROWS_WITH_AS( json(json::value_t::string).get(), - "[json.exception.type_error.302] type must be number, but is string"); - CHECK_THROWS_WITH( + "[json.exception.type_error.302] type must be number, but is string", json::type_error&); + CHECK_THROWS_WITH_AS( json(json::value_t::boolean).get(), "[json.exception.type_error.302] type must be number, but is " - "boolean"); + "boolean", json::type_error&); CHECK_NOTHROW( json(json::value_t::number_integer).get()); @@ -1450,11 +1343,9 @@ TEST_CASE("value conversion") SECTION("exception in case of a non-object type") { - CHECK_THROWS_AS((json().get>()), - json::type_error&); - CHECK_THROWS_WITH( + CHECK_THROWS_WITH_AS( (json().get>()), - "[json.exception.type_error.302] type must be object, but is null"); + "[json.exception.type_error.302] type must be object, but is null", json::type_error&); } } @@ -1495,9 +1386,8 @@ TEST_CASE("value conversion") SECTION("std::array is larger than JSON") { std::array arr6 = {{1, 2, 3, 4, 5, 6}}; - CHECK_THROWS_AS(j1.get_to(arr6), json::out_of_range&); - CHECK_THROWS_WITH(j1.get_to(arr6), "[json.exception.out_of_range.401] " - "array index 4 is out of range"); + CHECK_THROWS_WITH_AS(j1.get_to(arr6), "[json.exception.out_of_range.401] " + "array index 4 is out of range", json::out_of_range&); } SECTION("std::array is smaller than JSON") @@ -1564,14 +1454,12 @@ TEST_CASE("value conversion") json j7 = {0, 1, 2, 3}; json j8 = 2; - CHECK_THROWS_AS((j7.get>()), json::type_error&); - CHECK_THROWS_AS((j8.get>()), json::type_error&); - CHECK_THROWS_WITH((j7.get>()), + CHECK_THROWS_WITH_AS((j7.get>()), "[json.exception.type_error.302] type must be array, " - "but is number"); - CHECK_THROWS_WITH((j8.get>()), + "but is number", json::type_error&); + CHECK_THROWS_WITH_AS((j8.get>()), "[json.exception.type_error.302] type must be array, " - "but is number"); + "but is number", json::type_error&); SECTION("superfluous entries") { @@ -1591,14 +1479,12 @@ TEST_CASE("value conversion") json j7 = {0, 1, 2, 3}; json j8 = 2; - CHECK_THROWS_AS((j7.get>()), json::type_error&); - CHECK_THROWS_AS((j8.get>()), json::type_error&); - CHECK_THROWS_WITH((j7.get>()), + CHECK_THROWS_WITH_AS((j7.get>()), "[json.exception.type_error.302] type must be array, " - "but is number"); - CHECK_THROWS_WITH((j8.get>()), + "but is number", json::type_error&); + CHECK_THROWS_WITH_AS((j8.get>()), "[json.exception.type_error.302] type must be array, " - "but is number"); + "but is number", json::type_error&); SECTION("superfluous entries") { @@ -1610,32 +1496,26 @@ TEST_CASE("value conversion") SECTION("exception in case of a non-object type") { - CHECK_THROWS_AS((json().get>()), json::type_error&); - CHECK_THROWS_AS((json().get>()), json::type_error&); - CHECK_THROWS_AS((json().get>()), json::type_error&); - CHECK_THROWS_AS((json().get>()), json::type_error&); - CHECK_THROWS_AS((json().get>()), json::type_error&); - // does type really must be an array? or it rather must not be null? // that's what I thought when other test like this one broke - CHECK_THROWS_WITH( + CHECK_THROWS_WITH_AS( (json().get>()), - "[json.exception.type_error.302] type must be array, but is null"); - CHECK_THROWS_WITH( + "[json.exception.type_error.302] type must be array, but is null", json::type_error&); + CHECK_THROWS_WITH_AS( (json().get>()), - "[json.exception.type_error.302] type must be array, but is null"); - CHECK_THROWS_WITH( + "[json.exception.type_error.302] type must be array, but is null", json::type_error&); + CHECK_THROWS_WITH_AS( (json().get>()), - "[json.exception.type_error.302] type must be array, but is null"); - CHECK_THROWS_WITH( + "[json.exception.type_error.302] type must be array, but is null", json::type_error&); + CHECK_THROWS_WITH_AS( (json().get>()), - "[json.exception.type_error.302] type must be array, but is null"); - CHECK_THROWS_WITH( + "[json.exception.type_error.302] type must be array, but is null", json::type_error&); + CHECK_THROWS_WITH_AS( (json().get>()), - "[json.exception.type_error.302] type must be array, but is null"); - CHECK_THROWS_WITH( + "[json.exception.type_error.302] type must be array, but is null", json::type_error&); + CHECK_THROWS_WITH_AS( (json().get>()), - "[json.exception.type_error.302] type must be array, but is null"); + "[json.exception.type_error.302] type must be array, but is null", json::type_error&); } } }