You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by he...@apache.org on 2018/08/16 13:33:55 UTC

[commons-jexl] branch master updated: JEXL-267: added test illustrating intended behaviors

This is an automated email from the ASF dual-hosted git repository.

henrib pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-jexl.git


The following commit(s) were added to refs/heads/master by this push:
     new b6c6db7  JEXL-267: added test illustrating intended behaviors
b6c6db7 is described below

commit b6c6db7c60726c1eeefe90da8506941ec1ad561b
Author: henrib <he...@apache.org>
AuthorDate: Thu Aug 16 15:33:23 2018 +0200

    JEXL-267: added test illustrating intended behaviors
---
 .../org/apache/commons/jexl3/Issues200Test.java     | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/src/test/java/org/apache/commons/jexl3/Issues200Test.java b/src/test/java/org/apache/commons/jexl3/Issues200Test.java
index 625962d..31fb8f8 100644
--- a/src/test/java/org/apache/commons/jexl3/Issues200Test.java
+++ b/src/test/java/org/apache/commons/jexl3/Issues200Test.java
@@ -632,4 +632,25 @@ public class Issues200Test extends JexlTestCase {
         Assert.assertEquals(4, result);
         Assert.assertEquals(4, msi.size());
     }
+    
+    @Test
+    public void test267() throws Exception {
+        Object result;
+        JexlScript script;
+        JexlEngine jexl = new JexlBuilder().create();
+        JexlContext ctxt = new MapContext();
+        // API declared params
+        script = jexl.createScript("x + y", "x", "y");
+        result = script.execute(ctxt, 20, 22);
+        Assert.assertEquals(42, result);
+        // script declared params
+        script = jexl.createScript("(x, y)->{ x + y}");
+        result = script.execute(ctxt, 22, 20);
+        Assert.assertEquals(42, result);
+        // explicitly returning the lambda
+        script = jexl.createScript("return (x, y)->{ x + y}");
+        result = script.execute(ctxt);
+        Assert.assertTrue(result instanceof JexlScript);
+    }
+        
 }