-Fixed potential inifinite loop when parsing unquoted value

-Added NuGet install.ps1
-Incremented version to 5.0.6
This commit is contained in:
James Newton-King
2013-06-01 14:18:20 +12:00
parent 1b63698c02
commit 13aa07f63e
9 changed files with 144 additions and 9 deletions
@@ -47,6 +47,32 @@ namespace Newtonsoft.Json.Tests
[TestFixture]
public class JsonTextReaderTest : TestFixtureBase
{
[Test]
public void ThrowErrorWhenParsingUnquoteStringThatStartsWithNE()
{
const string json = @"{ ""ItemName"": ""value"", ""u"":netanelsalinger,""r"":9 }";
JsonTextReader reader = new JsonTextReader(new StringReader(json));
Assert.IsTrue(reader.Read());
Assert.AreEqual(JsonToken.StartObject, reader.TokenType);
Assert.IsTrue(reader.Read());
Assert.AreEqual(JsonToken.PropertyName, reader.TokenType);
Assert.IsTrue(reader.Read());
Assert.AreEqual(JsonToken.String, reader.TokenType);
Assert.IsTrue(reader.Read());
Assert.AreEqual(JsonToken.PropertyName, reader.TokenType);
ExceptionAssert.Throws<JsonReaderException>("Unexpected content while parsing JSON. Path 'u', line 1, position 27.",
() =>
{
reader.Read();
});
}
[Test]
public void FloatParseHandling()
{