Fixed merging with self bug.
This commit is contained in:
committed by
James Newton-King
parent
07c34f24cb
commit
da0f0d8dd1
@@ -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()
|
||||
{
|
||||
|
||||
@@ -1164,6 +1164,8 @@ namespace Newtonsoft.Json.Linq
|
||||
#endif
|
||||
break;
|
||||
case MergeArrayHandling.Replace:
|
||||
if (target == content)
|
||||
break;
|
||||
target.ClearItems();
|
||||
foreach (JToken item in content)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user