This commit is contained in:
James Newton-King
2016-01-09 13:14:58 +13:00
parent cfafebe1e5
commit 2491737e52
2 changed files with 23 additions and 1 deletions
@@ -1063,6 +1063,27 @@ third line", jsonTextReader.Value);
Assert.AreEqual(JsonToken.Null, reader.TokenType); Assert.AreEqual(JsonToken.Null, reader.TokenType);
} }
[Test]
public void UnexpectedEndAfterReadingN()
{
JsonTextReader reader = new JsonTextReader(new StringReader("n"));
ExceptionAssert.Throws<JsonReaderException>(() => reader.Read(), "Unexpected end when reading JSON. Path '', line 1, position 1.");
}
[Test]
public void UnexpectedEndAfterReadingNu()
{
JsonTextReader reader = new JsonTextReader(new StringReader("nu"));
ExceptionAssert.Throws<JsonReaderException>(() => reader.Read(), "Unexpected end when reading JSON. Path '', line 1, position 2.");
}
[Test]
public void UnexpectedEndAfterReadingNe()
{
JsonTextReader reader = new JsonTextReader(new StringReader("ne"));
ExceptionAssert.Throws<JsonReaderException>(() => reader.Read(), "Unexpected end when reading JSON. Path '', line 1, position 2.");
}
[Test] [Test]
public void ReadInt32Overflow() public void ReadInt32Overflow()
{ {
+2 -1
View File
@@ -1564,7 +1564,8 @@ namespace Newtonsoft.Json
} }
else else
{ {
CreateUnexpectedEndException(); _charPos++;
throw CreateUnexpectedEndException();
} }
return true; return true;
case 'N': case 'N':