tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r896557 - /tomcat/trunk/test/org/apache/el/TestELEvaluation.java
Date Wed, 06 Jan 2010 17:33:31 GMT
Author: markt
Date: Wed Jan  6 17:33:26 2010
New Revision: 896557

URL: http://svn.apache.org/viewvc?rev=896557&view=rev
Log:
Start to expand the EL test cases

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=896557&r1=896556&r2=896557&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/el/TestELEvaluation.java (original)
+++ tomcat/trunk/test/org/apache/el/TestELEvaluation.java Wed Jan  6 17:33:26 2010
@@ -46,9 +46,32 @@
         assertEquals("false", evaluateExpression("${false?true:false}"));
     }
 
-    public void testMisc() {
-        // From bug 45451 - not a parser bug
-        assertEquals("\\", evaluateExpression("\\\\"));
+    public void testParserLiteralExpression() {
+        // 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
+        assertEquals("\\\\", evaluateExpression("\\\\"));
+    }
+
+    public void testParserStringLiteral() {
+        // 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
+        assertEquals("\\", evaluateExpression("${'\\\\'}"));
+        assertEquals("\\", evaluateExpression("${\"\\\\\"}"));
+
+        // Can use ''' inside '"' when quoting with '"' and vice versa without
+        // escaping
+        assertEquals("\\\"", evaluateExpression("${'\\\\\"'}"));
+        assertEquals("\"\\", evaluateExpression("${'\"\\\\'}"));
+        assertEquals("\\'", evaluateExpression("${'\\\\\\''}"));
+        assertEquals("'\\", evaluateExpression("${'\\'\\\\'}"));
+        assertEquals("\\'", evaluateExpression("${\"\\\\'\"}"));
+        assertEquals("'\\", evaluateExpression("${\"'\\\\\"}"));
+        assertEquals("\\\"", evaluateExpression("${\"\\\\\\\"\"}"));
+        assertEquals("\"\\", evaluateExpression("${\"\\\"\\\\\"}"));
     }
 
     private void compareBoth(String msg, int expected, Object o1, Object o2){



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


Mime
View raw message