Test that char* are copied

This commit is contained in:
Benoit Blanchon committed 2014-09-28 21:35:08 +02:00
1 parent e417c137fc
commit d3cf568d07
2 files changed
+10 -2

No files matched your search

+1 -2
View File
@@ -47,8 +47,7 @@ void JsonValue::operator=(JsonValue const& value)
return; return;
} }
JsonNodeType nodeType = value._node ? value._node->type : JSON_UNDEFINED; JsonNodeType nodeType = value._node ? value._node->type : JSON_UNDEFINED;
switch (nodeType) switch (nodeType)
{ {
+9
View File
@@ -84,4 +84,13 @@ TEST_F(JsonValueTests, BooleanValuesAreCopied)
jsonValue1 = false; jsonValue1 = false;
EXPECT_TRUE((bool) jsonValue2); EXPECT_TRUE((bool) jsonValue2);
}
TEST_F(JsonValueTests, CharPointersAreCopied)
{
jsonValue1 = "hello";
jsonValue2 = jsonValue1;
jsonValue1 = "world";
EXPECT_STREQ("hello", (const char*) jsonValue2);
} }