You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2010/01/10 13:44:31 UTC

svn commit: r897627 - /tomcat/trunk/test/org/apache/el/TestELEvaluation.java

Author: markt
Date: Sun Jan 10 12:44:31 2010
New Revision: 897627

URL: http://svn.apache.org/viewvc?rev=897627&view=rev
Log:
Add tests for a bug found whilst reviewing the ELParser

Modified:
    tomcat/trunk/test/org/apache/el/TestELEvaluation.java

Modified: tomcat/trunk/test/org/apache/el/TestELEvaluation.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/el/TestELEvaluation.java?rev=897627&r1=897626&r2=897627&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/el/TestELEvaluation.java (original)
+++ tomcat/trunk/test/org/apache/el/TestELEvaluation.java Sun Jan 10 12:44:31 2010
@@ -21,6 +21,7 @@
 import java.lang.reflect.Method;
 import java.util.Date;
 
+import javax.el.ELException;
 import javax.el.ValueExpression;
 import javax.el.FunctionMapper;
 
@@ -115,10 +116,27 @@
         // Inspired by work on bug 45451, comments from kkolinko on the dev
         // list and looking at the spec to find some edge cases
         
-        // '\' is only an escape character inside a StringLiteral
+        // The only characters that can be escaped inside a String literal
+        // are \ " and '. # and $ are not escaped inside a String literal.
         assertEquals("\\", evaluateExpression("${'\\\\'}"));
         assertEquals("\\", evaluateExpression("${\"\\\\\"}"));
+        assertEquals("\\\"'$#", evaluateExpression("${'\\\\\\\"\\'$#'}"));
+        assertEquals("\\\"'$#", evaluateExpression("${\"\\\\\\\"\\'$#\"}"));
+
+        // Trying to quote # or $ should throw an error
+        Exception e = null;
+        try {
+            evaluateExpression("${'\\$'}");
+        } catch (ELException el) {
+            e = el;
+        }
+        assertNotNull(e);
 
+        assertEquals("\\$", evaluateExpression("${'\\\\$'}"));
+        assertEquals("\\\\$", evaluateExpression("${'\\\\\\\\$'}"));
+        
+        
+        
         // Can use ''' inside '"' when quoting with '"' and vice versa without
         // escaping
         assertEquals("\\\"", evaluateExpression("${'\\\\\"'}"));



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