Author fuzz tests and fix a comment-related issue (#2935)
Co-authored-by: James Newton-King <james@newtonking.com>
This commit is contained in:
co-authored by
James Newton-King
parent
55a7204f9b
commit
2eaa475f88
@@ -1699,7 +1699,8 @@ null//comment
|
||||
|
||||
w.WriteToken(r, true);
|
||||
|
||||
StringAssert.AreEqual(@"/*comment*//*hi*/*/{/*comment*/
|
||||
StringAssert.AreEqual(@"//comment*//*hi*/
|
||||
{/*comment*/
|
||||
""Name"": /*comment*/ true/*comment after true*//*comment after comma*/,
|
||||
""ExpiryDate"": /*comment*/ new Constructor(
|
||||
/*comment*/,
|
||||
@@ -1715,6 +1716,20 @@ null//comment
|
||||
}/*comment *//*comment 1 */", sw.ToString());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NewlinesInSingleLineComments()
|
||||
{
|
||||
// it’s not possible for this to be created by parsing JSON,
|
||||
// but if someone gets creative with the API…
|
||||
var sw = new StringWriter();
|
||||
using (var w = new JsonTextWriter(sw))
|
||||
{
|
||||
w.WriteComment("*/\nsomething else");
|
||||
}
|
||||
|
||||
StringAssert.AreEqual("//*/\n//something else\n", sw.ToString());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void DisposeSupressesFinalization()
|
||||
{
|
||||
@@ -1820,4 +1835,4 @@ null//comment
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user