Add tests for AttributeParser and deferredSyntaxAllowedAsLiteral
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Sun, 31 Jan 2010 00:34:37 +0000 (00:34 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Sun, 31 Jan 2010 00:34:37 +0000 (00:34 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@904935 13f79535-47bb-0310-9956-ffa450edef68

test/org/apache/el/TestELInJsp.java
test/webapp/WEB-INF/tags/echo-deferred.tag [new file with mode: 0644]
test/webapp/WEB-INF/tags/implicit.tld [new file with mode: 0644]
test/webapp/bug45451.jspf
test/webapp/bug45451c.jsp
test/webapp/bug45451d.jspx
test/webapp/bug45451e.jsp [new file with mode: 0644]

index 0bfd536..8953e30 100644 (file)
@@ -165,6 +165,11 @@ public class TestELInJsp extends TomcatBaseTest {
         assertTrue(result.indexOf("06-\\2") > 0);      
         assertTrue(result.indexOf("07-\\${1+1}") > 0);
         assertTrue(result.indexOf("08-\\\\2") > 0); 
+        assertTrue(result.indexOf("09-2") > 0);
+        assertTrue(result.indexOf("10-#{1+1}") > 0);
+        assertTrue(result.indexOf("11-\\2") > 0);      
+        assertTrue(result.indexOf("12-\\#{1+1}") > 0);
+        assertTrue(result.indexOf("13-\\\\2") > 0); 
         
         res = getUrl("http://localhost:" + getPort() + "/test/bug45451c.jsp");
         result = res.toString();
@@ -180,6 +185,11 @@ public class TestELInJsp extends TomcatBaseTest {
         assertTrue(result.indexOf("06-\\${1+1}") > 0);
         assertTrue(result.indexOf("07-\\\\${1+1}") > 0);
         assertTrue(result.indexOf("08-\\\\${1+1}") > 0);
+        assertTrue(result.indexOf("09-#{1+1}") > 0);
+        assertTrue(result.indexOf("10-\\#{1+1}") > 0);
+        assertTrue(result.indexOf("11-\\#{1+1}") > 0);
+        assertTrue(result.indexOf("12-\\\\#{1+1}") > 0);
+        assertTrue(result.indexOf("13-\\\\#{1+1}") > 0);
 
         res = getUrl("http://localhost:" + getPort() + "/test/bug45451d.jspx");
         result = res.toString();
@@ -194,6 +204,32 @@ public class TestELInJsp extends TomcatBaseTest {
         assertTrue(result.indexOf("06-\\${1+1}") > 0);
         assertTrue(result.indexOf("07-\\\\${1+1}") > 0);
         assertTrue(result.indexOf("08-\\\\\\${1+1}") > 0);
+        assertTrue(result.indexOf("09-2") > 0);
+        assertTrue(result.indexOf("10-#{1+1}") > 0);
+        assertTrue(result.indexOf("11-\\#{1+1}") > 0);
+        assertTrue(result.indexOf("12-\\\\#{1+1}") > 0);
+        assertTrue(result.indexOf("13-\\\\\\#{1+1}") > 0);
+        
+        res = getUrl("http://localhost:" + getPort() + "/test/bug45451e.jsp");
+        result = res.toString();
+        System.out.println(result);
+        // Warning: JSP attribute escaping != Java String escaping
+        // Warning: Attributes are always unescaped before passing to the EL
+        //          processor
+        assertTrue(result.indexOf("00-2") > 0);
+        assertTrue(result.indexOf("01-${1+1}") > 0);
+        assertTrue(result.indexOf("02-\\${1+1}") > 0);
+        assertTrue(result.indexOf("03-\\\\${1+1}") > 0);
+        assertTrue(result.indexOf("04-2") > 0);
+        assertTrue(result.indexOf("05-${1+1}") > 0);
+        assertTrue(result.indexOf("06-\\2") > 0);      
+        assertTrue(result.indexOf("07-\\${1+1}") > 0);
+        assertTrue(result.indexOf("08-\\\\2") > 0); 
+        assertTrue(result.indexOf("09-#{1+1}") > 0);
+        assertTrue(result.indexOf("10-\\#{1+1}") > 0);
+        assertTrue(result.indexOf("11-\\#{1+1}") > 0);
+        assertTrue(result.indexOf("12-\\\\#{1+1}") > 0);
+        assertTrue(result.indexOf("13-\\\\#{1+1}") > 0);
     }
 
     public void testBug45511() throws Exception {
diff --git a/test/webapp/WEB-INF/tags/echo-deferred.tag b/test/webapp/WEB-INF/tags/echo-deferred.tag
new file mode 100644 (file)
index 0000000..caa6e61
--- /dev/null
@@ -0,0 +1,17 @@
+<%--\r
+ Licensed to the Apache Software Foundation (ASF) under one or more\r
+  contributor license agreements.  See the NOTICE file distributed with\r
+  this work for additional information regarding copyright ownership.\r
+  The ASF licenses this file to You under the Apache License, Version 2.0\r
+  (the "License"); you may not use this file except in compliance with\r
+  the License.  You may obtain a copy of the License at\r
+\r
+      http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+  Unless required by applicable law or agreed to in writing, software\r
+  distributed under the License is distributed on an "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+  See the License for the specific language governing permissions and\r
+  limitations under the License.\r
+--%>\r
+<%@ tag %><%@ attribute name="echo" deferredValue="true" %><p>${echo}</p>
\ No newline at end of file
diff --git a/test/webapp/WEB-INF/tags/implicit.tld b/test/webapp/WEB-INF/tags/implicit.tld
new file mode 100644 (file)
index 0000000..e99820a
--- /dev/null
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<taglib xmlns="http://java.sun.com/xml/ns/javaee"
+      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+      xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
+      http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd"
+      version="2.1">
+</taglib>
\ No newline at end of file
index 2d9f9b3..e4483e3 100644 (file)
 <tags:echo echo="06-\\${1+1}" />\r
 <tags:echo echo="07-\\\${1+1}" />\r
 <tags:echo echo="08-\\\\${1+1}" />\r
+<tags:echo echo="04-${1+1}" />\r
+<tags:echo echo="05-\${1+1}" />\r
+<tags:echo echo="06-\\${1+1}" />\r
+<tags:echo echo="07-\\\${1+1}" />\r
+<tags:echo echo="08-\\\\${1+1}" />\r
+<tags:echo-deferred echo="09-#{1+1}" />\r
+<tags:echo-deferred echo="10-\#{1+1}" />\r
+<tags:echo-deferred echo="11-\\#{1+1}" />\r
+<tags:echo-deferred echo="12-\\\#{1+1}" />\r
+<tags:echo-deferred echo="13-\\\\#{1+1}" />\r
index a1b8b06..38324a3 100644 (file)
@@ -14,6 +14,6 @@
   See the License for the specific language governing permissions and
   limitations under the License.
 --%>
-<%@page isELIgnored="true" %>
+<%@page isELIgnored="true" deferredSyntaxAllowedAsLiteral="true" %>
 <%@ taglib prefix="tags" tagdir="/WEB-INF/tags" %>
 <%@ include file="bug45451.jspf" %>
index 09a4785..5a0039f 100644 (file)
     <tags:echo echo="06-\\${1+1}" />\r
     <tags:echo echo="07-\\\${1+1}" />\r
     <tags:echo echo="08-\\\\${1+1}" />\r
+    <tags:echo-deferred echo="09-#{1+1}" />\r
+    <tags:echo-deferred echo="10-\#{1+1}" />\r
+    <tags:echo-deferred echo="11-\\#{1+1}" />\r
+    <tags:echo-deferred echo="12-\\\#{1+1}" />\r
+    <tags:echo-deferred echo="13-\\\\#{1+1}" />\r
   </body>\r
 </html>\r
 </jsp:root>
\ No newline at end of file
diff --git a/test/webapp/bug45451e.jsp b/test/webapp/bug45451e.jsp
new file mode 100644 (file)
index 0000000..b181d13
--- /dev/null
@@ -0,0 +1,19 @@
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+--%>
+<%@page deferredSyntaxAllowedAsLiteral="true" %>
+<%@ taglib prefix="tags" tagdir="/WEB-INF/tags" %>
+<%@ include file="bug45451.jspf" %>