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 2012/07/09 21:07:15 UTC
svn commit: r1359339 -
/commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl3/IssuesTest.java
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);
+ }
}