commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r391862 - /jakarta/commons/proper/jexl/trunk/src/test/org/apache/commons/jexl/JexlTest.java
Date Thu, 06 Apr 2006 00:20:34 GMT
Author: dion
Date: Wed Apr  5 17:20:32 2006
New Revision: 391862

URL: http://svn.apache.org/viewcvs?rev=391862&view=rev
Log:
Better coverage for relational operators.
Add commented out test for property assignment.

Modified:
    jakarta/commons/proper/jexl/trunk/src/test/org/apache/commons/jexl/JexlTest.java

Modified: jakarta/commons/proper/jexl/trunk/src/test/org/apache/commons/jexl/JexlTest.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/jexl/trunk/src/test/org/apache/commons/jexl/JexlTest.java?rev=391862&r1=391861&r2=391862&view=diff
==============================================================================
--- jakarta/commons/proper/jexl/trunk/src/test/org/apache/commons/jexl/JexlTest.java (original)
+++ jakarta/commons/proper/jexl/trunk/src/test/org/apache/commons/jexl/JexlTest.java Wed Apr
 5 17:20:32 2006
@@ -210,15 +210,36 @@
         assertExpression(jc, "a==true", Boolean.TRUE);
         assertExpression(jc, "a==false", Boolean.FALSE);
         assertExpression(jc, "true==false", Boolean.FALSE);
-        assertExpression(jc, "num < 3", Boolean.FALSE);
+        
+        assertExpression(jc, "2 < 3", Boolean.TRUE);
+        assertExpression(jc, "num < 5", Boolean.FALSE);
+        assertExpression(jc, "num < num", Boolean.FALSE);
+        assertExpression(jc, "num < null", Boolean.FALSE);
+        assertExpression(jc, "num < 2.5", Boolean.FALSE);
+        assertExpression(jc, "now2 < now", Boolean.FALSE); // test comparable
+//
+        assertExpression(jc, "'6' <= '5'", Boolean.FALSE);
         assertExpression(jc, "num <= 5", Boolean.TRUE);
-        assertExpression(jc, "num >= 5", Boolean.TRUE);
+        assertExpression(jc, "num <= num", Boolean.TRUE);
+        assertExpression(jc, "num <= null", Boolean.FALSE);
+        assertExpression(jc, "num <= 2.5", Boolean.FALSE);
+        assertExpression(jc, "now2 <= now", Boolean.FALSE); // test comparable
+
+//        
         assertExpression(jc, "'6' >= '5'", Boolean.TRUE);
+        assertExpression(jc, "num >= 5", Boolean.TRUE);
         assertExpression(jc, "num >= num", Boolean.TRUE);
         assertExpression(jc, "num >= null", Boolean.FALSE);
         assertExpression(jc, "num >= 2.5", Boolean.TRUE);
-        assertExpression(jc, "num > 4", Boolean.TRUE);
         assertExpression(jc, "now2 >= now", Boolean.TRUE); // test comparable
+
+        assertExpression(jc, "'6' > '5'", Boolean.TRUE);
+        assertExpression(jc, "num > 4", Boolean.TRUE);
+        assertExpression(jc, "num > num", Boolean.FALSE);
+        assertExpression(jc, "num > null", Boolean.FALSE);
+        assertExpression(jc, "num > 2.5", Boolean.TRUE);
+        assertExpression(jc, "now2 > now", Boolean.TRUE); // test comparable
+
         assertExpression(jc, "\"foo\" + \"bar\" == \"foobar\"", Boolean.TRUE);
 
     }
@@ -895,6 +916,8 @@
     {
         JexlContext jc = JexlHelper.createContext();
         jc.getVars().put("aString", "Hello");
+        Foo foo = new Foo();
+        jc.getVars().put("foo", foo);
         Parser parser = new Parser(new StringReader(";"));
         parser.parse(new StringReader("aString = 'World';"));
         
@@ -902,6 +925,9 @@
         assertEquals("hello variable not changed", "world", jc.getVars().get("hello"));
         assertExpression(jc, "result = 1 + 1", new Long(2));
         assertEquals("result variable not changed", new Long(2), jc.getVars().get("result"));
+        // todo: make sure properties can be assigned to, fall back to flat var if no property
+        // assertExpression(jc, "foo.property1 = '99'", "99");
+        // assertEquals("property not set", "99", foo.getProperty1());
     }
     
     public void testAntPropertiesWithMethods() throws Exception



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message