Additional tests for https://issues.apache.org/bugzilla/show_bug.cgi?id=48668
authorkkolinko <kkolinko@13f79535-47bb-0310-9956-ffa450edef68>
Sat, 6 Mar 2010 20:46:06 +0000 (20:46 +0000)
committerkkolinko <kkolinko@13f79535-47bb-0310-9956-ffa450edef68>
Sat, 6 Mar 2010 20:46:06 +0000 (20:46 +0000)
The TestCase currently passes:
the parts that do not pass currently are commented-out:
- in bug48668a.jsp: those that prevent JSP from being compiled
- in TestParser.java: also those that provide wrong output.

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@919847 13f79535-47bb-0310-9956-ffa450edef68

test/org/apache/jasper/compiler/TestParser.java
test/webapp/WEB-INF/tags/bug48668.tagx [new file with mode: 0644]
test/webapp/bug48668a.jsp

index aa04249..4d3654b 100644 (file)
@@ -58,8 +58,37 @@ public class TestParser extends TomcatBaseTest {
         ByteChunk res = getUrl("http://localhost:" + getPort() +
                 "/test/bug48668a.jsp");
         String result = res.toString();
+        System.out.println(result);
         assertEcho(result, "00-Hello world</p>#{foo.bar}");
         assertEcho(result, "01-Hello world</p>${foo.bar}");
+        assertEcho(result, "10-Hello ${'foo.bar}");
+        assertEcho(result, "11-Hello ${'foo.bar}");
+        //assertEcho(result, "12-Hello #{'foo.bar}");
+        //assertEcho(result, "13-Hello #{'foo.bar}");
+        assertEcho(result, "14-Hello ${'foo}");
+        assertEcho(result, "15-Hello ${'foo}");
+        //assertEcho(result, "16-Hello #{'foo}");
+        //assertEcho(result, "17-Hello #{'foo}");
+        assertEcho(result, "18-Hello ${'foo.bar}");
+        assertEcho(result, "19-Hello ${'foo.bar}");
+        assertEcho(result, "20-Hello #{'foo.bar}");
+        assertEcho(result, "21-Hello #{'foo.bar}");
+        assertEcho(result, "30-Hello ${'foo}");
+        assertEcho(result, "31-Hello ${'foo}");
+        assertEcho(result, "32-Hello #{'foo}");
+        assertEcho(result, "33-Hello #{'foo}");
+        assertEcho(result, "34-Hello ${'foo}");
+        //assertEcho(result, "35-Hello ${'foo}");
+        assertEcho(result, "36-Hello #{'foo}");
+        //assertEcho(result, "37-Hello #{'foo}");
+        assertEcho(result, "40-Hello ${'foo}");
+        //assertEcho(result, "41-Hello ${'foo}");
+        //assertEcho(result, "42-Hello #{'foo}");
+        //assertEcho(result, "43-Hello #{'foo}");
+        assertEcho(result, "50-Hello ${'foo}");
+        //assertEcho(result, "51-Hello ${'foo}");
+        //assertEcho(result, "52-Hello #{'foo}");
+        //assertEcho(result, "53-Hello #{'foo}");
     }
 
     public void testBug48668b() throws Exception {
diff --git a/test/webapp/WEB-INF/tags/bug48668.tagx b/test/webapp/WEB-INF/tags/bug48668.tagx
new file mode 100644 (file)
index 0000000..db8587a
--- /dev/null
@@ -0,0 +1,26 @@
+<?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.
+-->
+<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0">
+<jsp:directive.tag body-content="scriptless" />
+<jsp:directive.attribute name="expr" type="java.lang.String" rtexprvalue="true"/>
+<jsp:directive.attribute name="noexpr" type="java.lang.String" rtexprvalue="false"/>
+<jsp:directive.attribute name="fragment" fragment="true" />
+<jsp:text>${expr}${noexpr}</jsp:text>
+<jsp:invoke fragment="fragment" />
+<jsp:doBody />
+</jsp:root>
index e995c2c..94a9442 100644 (file)
   <body>
     <p><tags:echo echo="00-Hello world" />#{foo.bar}</p>
     <p><tags:echo echo="01-Hello world" />${foo.bar}</p>
+
+    <p>10-<tags:bug48668 expr="Hello ${'foo.bar}" /></p>
+    <p>11-Hello <tags:bug48668 expr="${'foo.bar}" /></p>
+<%--<p>12-<tags:bug48668 expr="Hello #{'foo.bar}" /></p>--%>
+<%--<p>13-Hello <tags:bug48668 expr="#{'foo.bar}" /></p>--%>
+
+    <p>14-<tags:bug48668 expr="Hello ${'foo" />}</p>
+    <p>15-Hello <tags:bug48668 expr="${'foo" />}</p>
+<%--<p>16-<tags:bug48668 expr="Hello #{'foo" />}</p>--%>
+<%--<p>17-Hello <tags:bug48668 expr="#{'foo" />}</p>--%>
+
+    <p>18-<tags:bug48668 ><jsp:attribute name="expr">Hello ${'foo.bar}</jsp:attribute></tags:bug48668></p>
+    <p>19-Hello <tags:bug48668 ><jsp:attribute name="expr">${'foo.bar}</jsp:attribute></tags:bug48668></p>
+    <p>20-<tags:bug48668 ><jsp:attribute name="expr">Hello #{'foo.bar}</jsp:attribute></tags:bug48668></p>
+    <p>21-Hello <tags:bug48668 ><jsp:attribute name="expr">#{'foo.bar}</jsp:attribute></tags:bug48668></p>
+
+    <p>30-<tags:bug48668 noexpr="Hello ${'foo}"/></p>
+    <p>31-Hello <tags:bug48668 noexpr="${'foo}"/></p>
+    <p>32-<tags:bug48668 noexpr="Hello #{'foo}"/></p>
+    <p>33-Hello <tags:bug48668 noexpr="#{'foo}"/></p>
+    <p>34-<tags:bug48668><jsp:attribute name="noexpr">Hello ${'foo}</jsp:attribute></tags:bug48668></p>
+<%--<p>35-Hello <tags:bug48668><jsp:attribute name="noexpr">${'foo}</jsp:attribute></tags:bug48668></p>--%>
+    <p>36-<tags:bug48668><jsp:attribute name="noexpr">Hello #{'foo}</jsp:attribute></tags:bug48668></p>
+<%--<p>37-Hello <tags:bug48668><jsp:attribute name="noexpr">#{'foo}</jsp:attribute></tags:bug48668></p>--%>
+
+    <p>40-<tags:bug48668><jsp:attribute name="fragment">Hello ${'foo}</jsp:attribute></tags:bug48668></p>
+    <p>41-Hello <tags:bug48668><jsp:attribute name="fragment">${'foo}</jsp:attribute></tags:bug48668></p>
+    <p>42-<tags:bug48668><jsp:attribute name="fragment">Hello #{'foo}</jsp:attribute></tags:bug48668></p>
+<%--<p>43-Hello <tags:bug48668><jsp:attribute name="fragment">#{'foo}</jsp:attribute></tags:bug48668></p>--%>
+
+    <p>50-<tags:bug48668>Hello ${'foo}</tags:bug48668></p>
+    <p>51-Hello <tags:bug48668>${'foo}</tags:bug48668></p>
+    <p>52-<tags:bug48668>Hello #{'foo}</tags:bug48668></p>
+<%--<p>53-Hello <tags:bug48668>#{'foo}</tags:bug48668></p>--%>
   </body>
 </html>