This commit is contained in:
James Newton-King
2017-03-23 21:08:15 +13:00
parent 68533cdc19
commit 39c03ea0e9
+19 -1
View File
@@ -545,7 +545,14 @@ Parameter name: index");
{
string json = "[1,2/*comment*/,3]";
JArray a = JArray.Parse(json, new JsonLoadSettings
JArray a = JArray.Parse(json, new JsonLoadSettings());
Assert.AreEqual(3, a.Count);
Assert.AreEqual(1, (int)a[0]);
Assert.AreEqual(2, (int)a[1]);
Assert.AreEqual(3, (int)a[2]);
a = JArray.Parse(json, new JsonLoadSettings
{
CommentHandling = CommentHandling.Ignore
});
@@ -554,6 +561,17 @@ Parameter name: index");
Assert.AreEqual(1, (int)a[0]);
Assert.AreEqual(2, (int)a[1]);
Assert.AreEqual(3, (int)a[2]);
a = JArray.Parse(json, new JsonLoadSettings
{
CommentHandling = CommentHandling.Load
});
Assert.AreEqual(4, a.Count);
Assert.AreEqual(1, (int)a[0]);
Assert.AreEqual(2, (int)a[1]);
Assert.AreEqual(JTokenType.Comment, a[2].Type);
Assert.AreEqual(3, (int)a[3]);
}
[Test]