mirror of
https://github.com/nlohmann/json.git
synced 2026-10-23 22:38:55 +00:00
Skip the get_to result check without exceptions
Without exceptions, the get_to calls in CHECK_THROWS_WITH_AS do not run, so the array keeps its initial values (ci_test_noexceptions). Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
1 file changed
+2
@@ -369,7 +369,9 @@ TEST_CASE("constructors")
|
||||
std::array<int, 3> a{{0, 0, 0}};
|
||||
CHECK_THROWS_WITH_AS(j2.get_to(a), "[json.exception.type_error.302] type must be number, but is string", json::type_error&);
|
||||
CHECK_THROWS_WITH_AS(j.get_to(a), "[json.exception.out_of_range.401] array index 1 is out of range", json::out_of_range&);
|
||||
#if !defined(JSON_NOEXCEPTION) // without exceptions, the get_to calls in CHECK_THROWS_WITH_AS do not run
|
||||
CHECK(a[0] == 1);
|
||||
#endif
|
||||
|
||||
json const j3{"one", "two"};
|
||||
CHECK_THROWS_WITH_AS((j3.get<std::array<std::string, 3>>()), "[json.exception.out_of_range.401] array index 2 is out of range", json::out_of_range&);
|
||||
|
||||
Reference in new issue
Block a user