Skip to content

Commit

Permalink
add additional edge case test
Browse files Browse the repository at this point in the history
  • Loading branch information
nikoraes committed Apr 24, 2024
1 parent 597b287 commit 698a874
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions JexlNet.Test/Evaluator/Evaluator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,32 @@ public async void EvaluateExpression_FiltersArrays2()
result = await _evaluator.EvalAsync(ast);
Assert.Equal("baz", result?.ToString());
}

[Fact]
public async void EvaluateExpression_FiltersArrays3()
{
JsonObject context = new()
{
{ "foo", new JsonObject
{
{ "bar", new JsonArray
{
new JsonObject { { "tek", "hello" }, { "tok", "olleh" } },
new JsonObject { { "tek", "baz" }, { "tok", "olleh" } },
new JsonObject { { "tok", "baz" }, { "tak", "olleh" } }
}
}
}
}
};
Evaluator _evaluator;

_evaluator = new(new Grammar(), context);
var ast = ToTree("foo.bar[.tek == \"baz\" && .tok == 'olleh'].tek");
var result = await _evaluator.EvalAsync(ast);
Assert.Equal("baz", result?.ToString());
}

[Fact]
public async void EvaluateExpression_AllowFiltersToSelectObjectProperties()
{
Expand Down

0 comments on commit 698a874

Please sign in to comment.