Skip to content

Commit

Permalink
$eval() "forgets" registered functions when called within
Browse files Browse the repository at this point in the history
parenthesis #58
  • Loading branch information
aeberhart committed Dec 10, 2024
1 parent a00a764 commit a50f5f9
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/test/java/com/dashjoin/jsonata/CustomFunctionTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,21 @@ public void testSupplier() {
Assertions.assertEquals("Hello world", expression.evaluate(null));
}

@Test
public void testEval() {
var expression = Jsonata.jsonata("$eval('$greet()')");
expression.registerFunction("greet", () -> "Hello world");
Assertions.assertEquals("Hello world", expression.evaluate(null));
}

@Disabled
@Test
public void testEvalWithParams() {
var expression = Jsonata.jsonata("($eval('$greet()'))");
expression.registerFunction("greet", () -> "Hello world");
Assertions.assertEquals("Hello world", expression.evaluate(null));
}

@Test
public void testUnary() {
var expression = Jsonata.jsonata("$echo(123)");
Expand Down

0 comments on commit a50f5f9

Please sign in to comment.