feature: implement new regex equals operator for JsonPath Query expression. Example: Blah[?( @.name =~'/hi/i' )]
This commit is contained in:
@@ -314,6 +314,17 @@ namespace Newtonsoft.Json.Tests.Linq.JsonPath
|
||||
Assert.AreEqual("h\\i", (string)(JToken)expressions.Right);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SinglePropertyAndFilterWithRegex()
|
||||
{
|
||||
JPath path = new JPath("Blah[ ?( @.name=~'/hi/i' ) ]");
|
||||
Assert.AreEqual(2, path.Filters.Count);
|
||||
Assert.AreEqual("Blah", ((FieldFilter)path.Filters[0]).Name);
|
||||
BooleanQueryExpression expressions = (BooleanQueryExpression)((QueryFilter)path.Filters[1]).Expression;
|
||||
Assert.AreEqual(QueryOperator.RegExEquals, expressions.Operator);
|
||||
Assert.AreEqual("/hi/i", (string)(JToken)expressions.Right);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SinglePropertyAndFilterWithUnknownEscape()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user