commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hen...@apache.org
Subject svn commit: r811002 - in /commons/proper/jexl/branches/2.0/src: main/java/org/apache/commons/jexl/UnifiedJEXL.java test/java/org/apache/commons/jexl/UnifiedJEXLTest.java
Date Thu, 03 Sep 2009 15:46:55 GMT
Author: henrib
Date: Thu Sep  3 15:46:55 2009
New Revision: 811002

URL: http://svn.apache.org/viewvc?rev=811002&view=rev
Log:
Allow multiple statements in UnifiedJEXL expressions (ala JEXL Script versus JEXL Expression);
add test

Modified:
    commons/proper/jexl/branches/2.0/src/main/java/org/apache/commons/jexl/UnifiedJEXL.java
    commons/proper/jexl/branches/2.0/src/test/java/org/apache/commons/jexl/UnifiedJEXLTest.java

Modified: commons/proper/jexl/branches/2.0/src/main/java/org/apache/commons/jexl/UnifiedJEXL.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/branches/2.0/src/main/java/org/apache/commons/jexl/UnifiedJEXL.java?rev=811002&r1=811001&r2=811002&view=diff
==============================================================================
--- commons/proper/jexl/branches/2.0/src/main/java/org/apache/commons/jexl/UnifiedJEXL.java
(original)
+++ commons/proper/jexl/branches/2.0/src/main/java/org/apache/commons/jexl/UnifiedJEXL.java
Thu Sep  3 15:46:55 2009
@@ -823,7 +823,7 @@
      * @return the AST
      */
     private JexlNode toNode(CharSequence expression) throws ParseException {
-        return jexl.parse(expression, null).jjtGetChild(0);
+        return jexl.parse(expression, null);
     }
     
     /**
@@ -833,7 +833,7 @@
      * @return the AST
      */
     private JexlNode toNode(CharSequence expression, Info info) throws ParseException {
-        return jexl.parse(expression, info).jjtGetChild(0);
+        return jexl.parse(expression, info);
     }
 
     /**

Modified: commons/proper/jexl/branches/2.0/src/test/java/org/apache/commons/jexl/UnifiedJEXLTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/branches/2.0/src/test/java/org/apache/commons/jexl/UnifiedJEXLTest.java?rev=811002&r1=811001&r2=811002&view=diff
==============================================================================
--- commons/proper/jexl/branches/2.0/src/test/java/org/apache/commons/jexl/UnifiedJEXLTest.java
(original)
+++ commons/proper/jexl/branches/2.0/src/test/java/org/apache/commons/jexl/UnifiedJEXLTest.java
Thu Sep  3 15:46:55 2009
@@ -58,30 +58,10 @@
         public int getValue() {
             return value;
         }
-    }
-    
-    public static class Quux {
-        String str;
-        Froboz froboz;
-        public Quux(String str, int fro) {
-            this.str = str;
-            froboz = new Froboz(fro);
-        }
-        
-        public Froboz getFroboz() {
-            return froboz;
-        }
-        
-        public void setFroboz(Froboz froboz) {
-            this.froboz = froboz;
-        }
-        
-        public String getStr() {
-            return str;
-        }
-        
-        public void setStr(String str) {
-            this.str = str;
+        public int plus10() {
+            int i = value;
+            value += 10;
+            return i;
         }
     }
 
@@ -89,6 +69,12 @@
         super(testName);
     }
 
+    public void testStatement() throws Exception {
+        vars.put("froboz", new Froboz(123));
+        UnifiedJEXL.Expression check = EL.parse("${froboz.value = 32; froboz.plus10(); froboz.value}");
+        Object o = check.evaluate(context);
+        assertEquals("Result is not 42", new Integer(42), o);
+    }
 
     public void testAssign() throws Exception {
         UnifiedJEXL.Expression assign = EL.parse("${froboz.value = 10}");



Mime
View raw message