You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by js...@apache.org on 2002/11/20 13:58:40 UTC
cvs commit: jakarta-commons-sandbox/jexl/src/test/org/apache/commons/jexl JexlTest.java
jstrachan 2002/11/20 04:58:40
Modified: jexl/src/test/org/apache/commons/jexl JexlTest.java
Log:
added more unit tests to demonstrate the use of logical and and or in expressions
Revision Changes Path
1.24 +23 -1 jakarta-commons-sandbox/jexl/src/test/org/apache/commons/jexl/JexlTest.java
Index: JexlTest.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jexl/src/test/org/apache/commons/jexl/JexlTest.java,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- JexlTest.java 26 Oct 2002 09:26:38 -0000 1.23
+++ JexlTest.java 20 Nov 2002 12:58:39 -0000 1.24
@@ -719,6 +719,28 @@
}
/**
+ * test some blank strings
+ */
+ public void testLogicExpressions()
+ throws Exception
+ {
+ JexlContext jc = JexlHelper.createContext();
+ jc.getVars().put("foo", "abc" );
+ jc.getVars().put("bar", "def" );
+
+ assertExpression(jc, "foo == 'abc' || bar == 'abc'", Boolean.TRUE);
+ assertExpression(jc, "foo == 'abc' or bar == 'abc'", Boolean.TRUE);
+ assertExpression(jc, "foo == 'abc' && bar == 'abc'", Boolean.FALSE);
+ assertExpression(jc, "foo == 'abc' and bar == 'abc'", Boolean.FALSE);
+
+ assertExpression(jc, "foo == 'def' || bar == 'abc'", Boolean.FALSE);
+ assertExpression(jc, "foo == 'def' or bar == 'abc'", Boolean.FALSE);
+ assertExpression(jc, "foo == 'abc' && bar == 'def'", Boolean.TRUE);
+ assertExpression(jc, "foo == 'abc' and bar == 'def'", Boolean.TRUE);
+ }
+
+
+ /**
* test some simple double array lookups
*/
public void testDoubleArrays()
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>