mirror of
https://github.com/nlohmann/json.git
synced 2025-07-21 04:22:05 +03:00
🔨 added user-defined exceptions 201-202
Started implementing exceptions for invalid iterators.
This commit is contained in:
@ -662,22 +662,22 @@ TEST_CASE("modifiers")
|
||||
// pass iterator to a different array
|
||||
json j_another_array = {1, 2};
|
||||
json j_yet_another_array = {"first", "second"};
|
||||
CHECK_THROWS_AS(j_array.insert(j_another_array.end(), 10), std::domain_error);
|
||||
CHECK_THROWS_AS(j_array.insert(j_another_array.end(), j_value), std::domain_error);
|
||||
CHECK_THROWS_AS(j_array.insert(j_another_array.end(), 10, 11), std::domain_error);
|
||||
CHECK_THROWS_AS(j_array.insert(j_another_array.end(), j_yet_another_array.begin(),
|
||||
j_yet_another_array.end()), std::domain_error);
|
||||
CHECK_THROWS_AS(j_array.insert(j_another_array.end(), {1, 2, 3, 4}), std::domain_error);
|
||||
CHECK_THROWS_AS(j_array.insert(j_another_array.end(), 10), json::invalid_iterator);
|
||||
CHECK_THROWS_AS(j_array.insert(j_another_array.end(), j_value), json::invalid_iterator);
|
||||
CHECK_THROWS_AS(j_array.insert(j_another_array.end(), 10, 11), json::invalid_iterator);
|
||||
CHECK_THROWS_AS(j_array.insert(j_another_array.end(), j_yet_another_array.begin(), j_yet_another_array.end()), json::invalid_iterator);
|
||||
CHECK_THROWS_AS(j_array.insert(j_another_array.end(), {1, 2, 3, 4}), json::invalid_iterator);
|
||||
|
||||
CHECK_THROWS_WITH(j_array.insert(j_another_array.end(), 10), "iterator does not fit current value");
|
||||
CHECK_THROWS_WITH(j_array.insert(j_another_array.end(), 10),
|
||||
"[json.exception.invalid_iterator.202] iterator does not fit current value");
|
||||
CHECK_THROWS_WITH(j_array.insert(j_another_array.end(), j_value),
|
||||
"iterator does not fit current value");
|
||||
"[json.exception.invalid_iterator.202] iterator does not fit current value");
|
||||
CHECK_THROWS_WITH(j_array.insert(j_another_array.end(), 10, 11),
|
||||
"iterator does not fit current value");
|
||||
CHECK_THROWS_WITH(j_array.insert(j_another_array.end(), j_yet_another_array.begin(),
|
||||
j_yet_another_array.end()), "iterator does not fit current value");
|
||||
"[json.exception.invalid_iterator.202] iterator does not fit current value");
|
||||
CHECK_THROWS_WITH(j_array.insert(j_another_array.end(), j_yet_another_array.begin(), j_yet_another_array.end()),
|
||||
"[json.exception.invalid_iterator.202] iterator does not fit current value");
|
||||
CHECK_THROWS_WITH(j_array.insert(j_another_array.end(), {1, 2, 3, 4}),
|
||||
"iterator does not fit current value");
|
||||
"[json.exception.invalid_iterator.202] iterator does not fit current value");
|
||||
}
|
||||
|
||||
SECTION("non-array type")
|
||||
|
Reference in New Issue
Block a user