mirror of
https://github.com/nlohmann/json.git
synced 2026-10-16 19:18:12 +00:00
Fix the develop CI failures hidden behind cancelled jobs
- ci_test_noexceptions: the JSON Patch section of unit-throw_messages and the strict dumps in unit-serialization catch exceptions, which JSON_NOEXCEPTION turns into std::abort(); skip them there. - ci_cppcheck: insert() and iter_impl::key() ended with a call to a noreturn throw helper, which Cppcheck reports as missingReturn; check the error case first and end with the return, like the other functions. - ci_single_binaries: ordered_map.hpp uses the Hedley macros since #5838, so include hedley.hpp (IWYU). - MSVC: also wrap the second vector<json> comparison in unit-constructor2 in parentheses. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
7 files changed
+82
-71
No files matched your search
@@ -305,7 +305,7 @@ TEST_CASE("copy constructor and destructor across value types")
|
||||
// mutating the copy leaves the original alone
|
||||
copy[5] = "changed";
|
||||
copy[6].push_back(1);
|
||||
CHECK(copy != v);
|
||||
CHECK((copy != v));
|
||||
CHECK(v[5] == std::string(5, 'x'));
|
||||
CHECK(v[6].size() == 3);
|
||||
|
||||
|
||||
@@ -1374,7 +1374,13 @@ void check_dump_against_reference(const std::string& s, const bool with_strict =
|
||||
};
|
||||
for (const auto error_handler : error_handlers)
|
||||
{
|
||||
#if defined(JSON_NOEXCEPTION)
|
||||
// a strict dump of invalid UTF-8 calls std::abort() instead of throwing
|
||||
static_cast<void>(with_strict);
|
||||
if (error_handler == json::error_handler_t::strict)
|
||||
#else
|
||||
if (!with_strict && error_handler == json::error_handler_t::strict)
|
||||
#endif
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -94,6 +94,7 @@ TEST_CASE("exception messages of out-of-line throw sites")
|
||||
CHECK_MSG(obj.update(arr.begin(), arr2.end()), "[json.exception.invalid_iterator.210] iterators do not fit");
|
||||
}
|
||||
|
||||
#if !defined(JSON_NOEXCEPTION) // patch_msg() catches the exceptions, which JSON_NOEXCEPTION turns into std::abort()
|
||||
SECTION("patch")
|
||||
{
|
||||
const auto patch_msg = [](const char* doc, const char* patch)
|
||||
@@ -138,4 +139,5 @@ TEST_CASE("exception messages of out-of-line throw sites")
|
||||
CHECK(patch_msg("{\"a\":1}", "[{\"op\":\"test\",\"path\":\"/a\",\"value\":2}]") == "[json.exception.other_error.501] unsuccessful: {\"op\":\"test\",\"path\":\"/a\",\"value\":2}");
|
||||
CHECK(patch_msg("{\"a\":1}", "[{\"op\":\"move\",\"path\":\"/a\"}]") == "[json.exception.parse_error.105] parse error: operation 'move' must have member 'from'");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
Reference in new issue
Block a user