mirror of
https://github.com/nlohmann/json.git
synced 2026-10-28 19:45:22 +00:00
Fix test lints that are red on develop (effc++, clang-tidy) (#5946)
- unit-bson: initialize the SAX recorder's member (-Weffc++) - unit-json_patch: build the reference document independently instead of copying it (performance-unnecessary-copy-initialization) - unit-json_view_builder: use node_kind::link instead of an out-of-range enum cast (clang-analyzer-optin.core.EnumCastOutOfRange) Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
@@ -2178,8 +2178,13 @@ TEST_CASE("JSON patch - behavior documented in the API reference")
|
||||
|
||||
SECTION("patch() has the strong guarantee")
|
||||
{
|
||||
const json doc = R"({"a": [1, 2], "o": {"k": "v"}})"_json;
|
||||
const json before = doc;
|
||||
// independent values, so that the comparison below checks the untouched document
|
||||
const auto make_doc = []
|
||||
{
|
||||
return R"({"a": [1, 2], "o": {"k": "v"}})"_json;
|
||||
};
|
||||
const json doc = make_doc();
|
||||
const json before = make_doc();
|
||||
|
||||
const std::vector<json> failing =
|
||||
{
|
||||
@@ -2202,7 +2207,7 @@ TEST_CASE("JSON patch - behavior documented in the API reference")
|
||||
CHECK_THROWS_AS(doc.patch(patch), json::exception&);
|
||||
CHECK(doc == before);
|
||||
|
||||
json copy = doc;
|
||||
json copy = make_doc();
|
||||
CHECK_THROWS_AS(copy.patch(patch), json::exception&);
|
||||
CHECK(copy == before);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user