tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r897627 - /tomcat/trunk/test/org/apache/el/TestELEvaluation.java
Date Sun, 10 Jan 2010 12:44:31 GMT
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


Mime
View raw message