mirror of
https://github.com/nlohmann/json.git
synced 2026-11-19 09:45:20 +00:00
Fix the cppcheck, clang-tidy and legacy-comparison CI failures
- to_json_tuple_impl() moved the element in both branches of a ternary; only one runs, but cppcheck reported accessMoved. Use if/else. - The ABI tag test looked for "json_abi_bics", which misses when another tag comes first, as in json_abi_ldvcmp_bics; look for "_bics". - readability-qualified-auto in the items() test. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
3 files changed
+19
-4
No files matched your search
@@ -35,7 +35,8 @@ TEST_CASE("JSON_BRACE_INIT_COPY_SEMANTICS")
|
||||
SECTION("the macro is part of the ABI tag")
|
||||
{
|
||||
const std::string ns = STRINGIZE(NLOHMANN_JSON_NAMESPACE);
|
||||
CHECK(ns.find("json_abi_bics") != std::string::npos);
|
||||
// other tags may come before it, e.g. json_abi_ldvcmp_bics
|
||||
CHECK(ns.find("_bics") != std::string::npos);
|
||||
}
|
||||
|
||||
SECTION("single-element brace initialization copies the element (#5074)")
|
||||
@@ -156,7 +157,7 @@ TEST_CASE("JSON_BRACE_INIT_COPY_SEMANTICS")
|
||||
SECTION("items()")
|
||||
{
|
||||
json j_obj = {{"key", 1}};
|
||||
for (auto& el : j_obj.items())
|
||||
for (const auto& el : j_obj.items())
|
||||
{
|
||||
json const j = el;
|
||||
CHECK(j.dump() == "{\"key\":1}");
|
||||
|
||||
Reference in new issue
Block a user