-Fixed property after empty array JSONPath queries

-Fixed error handling when last value in array or object fails
This commit is contained in:
James Newton-King
2014-06-28 00:42:41 +12:00
parent b96f8ed254
commit 3335ae4e20
9 changed files with 265 additions and 63 deletions
@@ -50,6 +50,22 @@ namespace Newtonsoft.Json.Tests.Linq.JsonPath
[TestFixture]
public class JPathExecuteTests : TestFixtureBase
{
[Test]
public void SelectTokenAfterEmptyContainer()
{
string json = @"{
'cont': [],
'test': 'no one will find me'
}";
JObject o = JObject.Parse(json);
IList<JToken> results = o.SelectTokens("$..test").ToList();
Assert.AreEqual(1, results.Count);
Assert.AreEqual("no one will find me", (string)results[0]);
}
[Test]
public void EvaluatePropertyWithRequired()
{