commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hen...@apache.org
Subject svn commit: r1359339 - /commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl3/IssuesTest.java
Date Mon, 09 Jul 2012 19:07:15 GMT
Author: henrib
Date: Mon Jul  9 19:07:15 2012
New Revision: 1359339

URL: http://svn.apache.org/viewvc?rev=1359339&view=rev
Log:
Added test for JEXL-136 

Modified:
    commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl3/IssuesTest.java

Modified: commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl3/IssuesTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl3/IssuesTest.java?rev=1359339&r1=1359338&r2=1359339&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl3/IssuesTest.java (original)
+++ commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl3/IssuesTest.java Mon Jul
 9 19:07:15 2012
@@ -23,6 +23,7 @@ import java.math.MathContext;
 import java.util.HashMap;
 import java.util.Map;
 import org.apache.commons.jexl3.internal.introspection.Uberspect;
+import org.junit.Test;
 
 /**
  * Test cases for reported issues
@@ -873,4 +874,24 @@ public class IssuesTest extends JexlTest
         result = script.execute(null, foo, 2, 1);
         assertEquals(42, result);
     }
+
+
+    @Test
+    public void test136() throws Exception {
+        JexlEngine jexl = new Engine();
+        JexlContext jc = new MapContext();
+        JexlScript script;
+        JexlExpression expr;
+        Object result;
+
+        script = jexl.createScript("var x = $TAB[idx]; return x;", "idx");
+        jc.set("fn01", script);
+
+        script = jexl.createScript("$TAB = { 1:11, 2:22, 3:33}; IDX=2;");
+        script.execute(jc);
+
+        expr = jexl.createExpression("fn01(IDX)");
+        result = expr.evaluate(jc);
+        assertEquals("EXPR01 result", 22, result);
+    }
 }



Mime
View raw message