-Fixed bad BSON when writing long strings of complex UTF8 characters
-Fixed error not being raised for additional content in JSON string for JArray.Parse and JObject.Parse
This commit is contained in:
@@ -448,5 +448,18 @@ Parameter name: index")]
|
||||
Assert.AreEqual(123, (int)array[0]);
|
||||
Assert.AreEqual(456, (int)array[1]);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException(typeof(JsonReaderException), ExpectedMessage = "Unexpected state: Finished. Line 5, position 3.")]
|
||||
public void ParseAdditionalContent()
|
||||
{
|
||||
string json = @"[
|
||||
""Small"",
|
||||
""Medium"",
|
||||
""Large""
|
||||
], 987987";
|
||||
|
||||
JArray.Parse(json);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1624,5 +1624,23 @@ Parameter name: arrayIndex")]
|
||||
|
||||
Assert.AreEqual("9065acf3-c820-467d-be50-8d4664beaf35", v.ToString());
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException(typeof(JsonReaderException), ExpectedMessage = "Unexpected state: Finished. Line 10, position 3.")]
|
||||
public void ParseAdditionalContent()
|
||||
{
|
||||
string json = @"{
|
||||
""Name"": ""Apple"",
|
||||
""Expiry"": new Date(1230422400000),
|
||||
""Price"": 3.99,
|
||||
""Sizes"": [
|
||||
""Small"",
|
||||
""Medium"",
|
||||
""Large""
|
||||
]
|
||||
}, 987987";
|
||||
|
||||
JObject o = JObject.Parse(json);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -739,5 +739,18 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
|
||||
Assert.IsTrue(v1.DeepEquals(v2));
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException(typeof(JsonReaderException), ExpectedMessage = "Unexpected state: Finished. Line 5, position 3.")]
|
||||
public void ParseAdditionalContent()
|
||||
{
|
||||
string json = @"[
|
||||
""Small"",
|
||||
""Medium"",
|
||||
""Large""
|
||||
], 987987";
|
||||
|
||||
JToken.Parse(json);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user