-Fixed jsonpath error when parsing a property that follows an escaped property

-Changed reader/writer/token path to escape property names containing special characters
This commit is contained in:
James Newton-King
2014-10-18 15:36:42 +13:00
parent 01f1c5e261
commit 88a29704da
12 changed files with 385 additions and 287 deletions
@@ -643,5 +643,18 @@ namespace Newtonsoft.Json.Tests.Linq.JsonPath
{
ExceptionAssert.Throws<JsonException>(() => { new JPath("[1]Blah"); }, "Unexpected character following indexer: B");
}
[Test]
public void PropertyFollowingEscapedPropertyName()
{
JPath path = new JPath("frameworks.aspnetcore50.dependencies.['System.Xml.ReaderWriter'].source");
Assert.AreEqual(5, path.Filters.Count);
Assert.AreEqual("frameworks", ((FieldFilter)path.Filters[0]).Name);
Assert.AreEqual("aspnetcore50", ((FieldFilter)path.Filters[1]).Name);
Assert.AreEqual("dependencies", ((FieldFilter)path.Filters[2]).Name);
Assert.AreEqual("System.Xml.ReaderWriter", ((FieldFilter)path.Filters[3]).Name);
Assert.AreEqual("source", ((FieldFilter)path.Filters[4]).Name);
}
}
}