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/27 14:07:28 UTC

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

jstrachan    2002/11/27 05:07:28

  Modified:    jelly/src/java/org/apache/commons/jelly/expression/jexl
                        JexlExpression.java JexlExpressionFactory.java
               jelly/src/test/org/apache/commons/jelly/expression
                        TestExpressions.java
  Log:
  Patched the getExpressionText() implementations so that they show the full expression used in Jelly with ${} tokens. Also added a test case for this behaviour.
  
  Also patched JellyUnit so that it now takes advantage of this new method to show more meaningful messages when assertions fail.
  
  Revision  Changes    Path
  1.13      +6 -6      jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/expression/jexl/JexlExpression.java
  
  Index: JexlExpression.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/expression/jexl/JexlExpression.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- JexlExpression.java	27 Nov 2002 12:43:19 -0000	1.12
  +++ JexlExpression.java	27 Nov 2002 13:07:27 -0000	1.13
  @@ -103,7 +103,7 @@
       // Expression interface
       //------------------------------------------------------------------------- 
       public String getExpressionText() {
  -        return expression.getExpression();
  +        return "${" + expression.getExpression() + "}";
       }
       
       public Object evaluate(JellyContext context) {
  
  
  
  1.13      +6 -6      jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/expression/jexl/JexlExpressionFactory.java
  
  Index: JexlExpressionFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/expression/jexl/JexlExpressionFactory.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- JexlExpressionFactory.java	27 Nov 2002 12:43:18 -0000	1.12
  +++ JexlExpressionFactory.java	27 Nov 2002 13:07:27 -0000	1.13
  @@ -116,7 +116,7 @@
                   }
                   
                   public String getExpressionText() {
  -                    return text;
  +                    return "${" + text + "}";
                   }
                   
                   public String toString() {
  
  
  
  1.8       +4 -0      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.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- TestExpressions.java	30 Oct 2002 19:16:31 -0000	1.7
  +++ TestExpressions.java	27 Nov 2002 13:07:28 -0000	1.8
  @@ -176,5 +176,9 @@
           Object value = expression.evaluate(context);
           //assertEquals( "Expression for: " + expressionText + " is: " + expression, expectedValue, value );
           assertEquals( "Wrong result for expression: " + expressionText, expectedValue, value );
  +        
  +        String text = expression.getExpressionText();
  +        assertEquals( "Wrong textual representation for expression text: ", expressionText, text);
       }
  +    
   }
  
  
  

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