1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-30 11:43:15 +02:00

Fix -Wdangling-reference

This commit is contained in:
Eelco Dolstra 2025-04-02 21:21:08 +02:00 committed by Jörg Thalheim
parent 26b33aa1b0
commit 0f723769b7
2 changed files with 14 additions and 12 deletions

View file

@ -63,9 +63,7 @@ TEST(valueAt, simpleObject) {
auto nested = R"({ "hello": { "world": "" } })"_json;
auto & nestedObject = valueAt(getObject(nested), "hello");
ASSERT_EQ(valueAt(nestedObject, "world"), "");
ASSERT_EQ(valueAt(valueAt(getObject(nested), "hello"), "world"), "");
}
TEST(valueAt, missingKey) {
@ -83,7 +81,7 @@ TEST(getObject, rightAssertions) {
auto nested = R"({ "object": { "object": {} } })"_json;
auto & nestedObject = getObject(valueAt(getObject(nested), "object"));
auto nestedObject = getObject(valueAt(getObject(nested), "object"));
ASSERT_EQ(nestedObject, getObject(nlohmann::json::parse(R"({ "object": {} })")));
ASSERT_EQ(getObject(valueAt(getObject(nestedObject), "object")), (nlohmann::json::object_t {}));