Added JSON_PROXY to copy arrays and objects by reference

This commit is contained in:
Benoit Blanchon
2014-10-09 18:20:40 +02:00
parent bf2d726746
commit 35eaa55b3a
12 changed files with 138 additions and 66 deletions

View File

@ -101,12 +101,10 @@ TEST_F(JsonValueTests, ObjectsAreCopiedByReference)
JsonObject object = json.createObject();
jsonValue1 = object;
jsonValue2 = jsonValue1;
object["hello"] = "world";
jsonValue1 = 0;
EXPECT_EQ(1, ((JsonObject) jsonValue2).size());
EXPECT_EQ(1, ((JsonObject) jsonValue1).size());
}
TEST_F(JsonValueTests, ArraysAreCopiedByReference)
@ -114,10 +112,8 @@ TEST_F(JsonValueTests, ArraysAreCopiedByReference)
JsonArray array = json.createArray();
jsonValue1 = array;
jsonValue2 = jsonValue1;
jsonValue1 = 0;
array.add("world");
EXPECT_EQ(1, ((JsonObject) jsonValue2).size());
EXPECT_EQ(1, ((JsonObject) jsonValue1).size());
}