-Changed exception thrown when parsing invalid Unicode escape sequence to JsonReaderException
This commit is contained in:
@@ -983,6 +983,19 @@ null//comment
|
||||
|
||||
Assert.IsFalse(await r.ReadAsync());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task InvalidUnicodeSequence()
|
||||
{
|
||||
string json1 = @"{'prop':'\u123!'}";
|
||||
|
||||
JsonTextReader r = new JsonTextReader(new StringReader(json1));
|
||||
|
||||
Assert.IsTrue(await r.ReadAsync());
|
||||
Assert.IsTrue(await r.ReadAsync());
|
||||
|
||||
await ExceptionAssert.ThrowsAsync<JsonReaderException>(async () => { await r.ReadAsync(); }, @"Invalid Unicode escape sequence: \u123!. Path 'prop', line 1, position 11.");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1029,5 +1029,18 @@ null//comment
|
||||
GC.WaitForPendingFinalizers();
|
||||
Assert.AreEqual(1, UnmanagedResourceFakingJsonReader.DisposalCalls);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void InvalidUnicodeSequence()
|
||||
{
|
||||
string json1 = @"{'prop':'\u123!'}";
|
||||
|
||||
JsonTextReader r = new JsonTextReader(new StringReader(json1));
|
||||
|
||||
Assert.IsTrue(r.Read());
|
||||
Assert.IsTrue(r.Read());
|
||||
|
||||
ExceptionAssert.Throws<JsonReaderException>(() => { r.Read(); }, @"Invalid Unicode escape sequence: \u123!. Path 'prop', line 1, position 11.");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user