Fixed merging with self bug.

This commit is contained in:
iRumba
2019-08-18 18:07:53 +12:00
committed by James Newton-King
parent 07c34f24cb
commit da0f0d8dd1
2 changed files with 10 additions and 0 deletions
@@ -46,6 +46,14 @@ namespace Newtonsoft.Json.Tests.Linq
[TestFixture]
public class MergeTests : TestFixtureBase
{
[Test]
public void MergeSelf()
{
var a = new JArray { "1", "2" };
a.Merge(a, new JsonMergeSettings { MergeArrayHandling = MergeArrayHandling.Replace });
Assert.AreEqual(a, new JArray { "1", "2" });
}
[Test]
public void MergeNullString()
{
+2
View File
@@ -1164,6 +1164,8 @@ namespace Newtonsoft.Json.Linq
#endif
break;
case MergeArrayHandling.Replace:
if (target == content)
break;
target.ClearItems();
foreach (JToken item in content)
{