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/08/09 17:50:14 UTC

cvs commit: jakarta-commons-sandbox/jelly/src/test/org/apache/commons/jelly/expression TestExpressions.java

jstrachan    2002/08/09 08:50:14

  Modified:    jelly/src/test/org/apache/commons/jelly/expression
                        TestExpressions.java
  Log:
  some new (disabled) JUnit test cases that don't work yet but will do once we get a minor patch to Jexl in place so we can use sub-expression Resolvers to handle Ant-style expressions with dots in the name which shouldn't be treated as expressions.
  
  Revision  Changes    Path
  1.5       +39 -6     jakarta-commons-sandbox/jelly/src/test/org/apache/commons/jelly/expression/TestExpressions.java
  
  Index: TestExpressions.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/test/org/apache/commons/jelly/expression/TestExpressions.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- TestExpressions.java	10 Jul 2002 16:12:17 -0000	1.4
  +++ TestExpressions.java	9 Aug 2002 15:50:14 -0000	1.5
  @@ -119,22 +119,55 @@
           assertExpression("cheese ${maven.some.madeup.name}pizza", "cheese pizza");
           assertExpression("ham and ${maven.home.foo} pizza", "ham and cheese pizza");
       }
  -
  -/*    
  -    temporally disablled until jexl gets patched...
       
  -    public void testNull() throws Exception {
  +    public void testNotConditions() throws Exception {
  +        context.setVariable("a", Boolean.TRUE);
  +        context.setVariable("b", Boolean.FALSE);
  +        context.setVariable("c", "true");
  +        context.setVariable("d", "false");
  +        
  +        assertExpression("${a}", Boolean.TRUE);
  +        assertExpression("${!a}", Boolean.FALSE);
  +        assertExpression("${b}", Boolean.FALSE);
  +        assertExpression("${!b}", Boolean.TRUE);
  +        
  +        assertExpression("${c}", "true");
  +        assertExpression("${!c}", Boolean.FALSE);
  +        assertExpression("${d}", "false");
  +        assertExpression("${!d}", Boolean.TRUE);
  +    }
  +    
  +    // ##### re-enable this line once the Jexl sub-resolver work is complete!
  +    public void DISABLED_testNotConditionsWithDot() throws Exception {
  +        context.setVariable("x.a", Boolean.TRUE);
  +        context.setVariable("x.b", Boolean.FALSE);
  +        context.setVariable("x.c", "true");
  +        context.setVariable("x.d", "false");
  +        
  +        assertExpression("${x.a}", Boolean.TRUE);
  +        assertExpression("${!x.a}", Boolean.FALSE);
  +        assertExpression("${x.b}", Boolean.FALSE);
  +        assertExpression("${!x.b}", Boolean.TRUE);
  +        
  +        assertExpression("${x.c}", "true");
  +        assertExpression("${!x.c}", Boolean.FALSE);
  +        assertExpression("${x.d}", "false");
  +        assertExpression("${!x.d}", Boolean.TRUE);
  +    }
  +    
  +    // ##### re-enable this line once the Jexl sub-resolver work is complete!
  +    public void DISABLED_testNull() throws Exception {
           context.setVariable("something.blank", "");
           context.setVariable("something.ok", "cheese");
           
  -        assertExpression("${something.blank.length == 0}", Boolean.TRUE);
  +        
  +        assertExpression("${something.blank.length() == 0}", Boolean.TRUE);
           assertExpression("${something.blank == ''}", Boolean.TRUE);
           assertExpression("${something.ok != null}", Boolean.TRUE);
           assertExpression("${something.ok != ''}", Boolean.TRUE);
           assertExpression("${something.null != ''}", Boolean.FALSE);
           assertExpression("${unknown == null}", Boolean.TRUE);
       }
  -*/
       
       protected void assertExpression(String expressionText, Object expectedValue) throws Exception {
           Expression expression = CompositeExpression.parse(expressionText, factory);
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>