Fix handling of empty constructor names (#2922)
Co-authored-by: James Newton-King <james@newtonking.com>
This commit is contained in:
co-authored by
James Newton-King
parent
01e1759cac
commit
55a7204f9b
@@ -118,6 +118,17 @@ namespace Newtonsoft.Json.Tests
|
||||
}, "No JSON content found. Path '', line 0, position 0.");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NoConstructorName() {
|
||||
ExceptionAssert.Throws<JsonException>(
|
||||
() => JsonConvert.DeserializeObject("[new \0("),
|
||||
"Empty constructor name. Path '', line 1, position 6.");
|
||||
|
||||
ExceptionAssert.Throws<JsonException>(
|
||||
() => JsonConvert.DeserializeObject("{'x':new \0("),
|
||||
"Empty constructor name. Path 'x', line 1, position 10.");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void PopulateObjectWithOnlyComment()
|
||||
{
|
||||
@@ -1830,4 +1841,4 @@ namespace Newtonsoft.Json.Tests
|
||||
public DateTime Expiration { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user