incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bdelacre...@apache.org
Subject svn commit: r689056 - in /incubator/sling/trunk/scripting/jst/src: main/java/org/apache/sling/scripting/jst/ test/java/org/apache/sling/scripting/jst/ test/resources/jscode/
Date Tue, 26 Aug 2008 13:01:29 GMT
Author: bdelacretaz
Date: Tue Aug 26 06:01:28 2008
New Revision: 689056

URL: http://svn.apache.org/viewvc?rev=689056&view=rev
Log:
SLING-615 - body tag regexp was wrong, caused some jst scripts to fail

Modified:
    incubator/sling/trunk/scripting/jst/src/main/java/org/apache/sling/scripting/jst/BodyOnlyScriptFilteredCopy.java
    incubator/sling/trunk/scripting/jst/src/test/java/org/apache/sling/scripting/jst/BodyOnlyScriptFilteredCopyTest.java
    incubator/sling/trunk/scripting/jst/src/test/java/org/apache/sling/scripting/jst/JsCodeGeneratorTest.java
    incubator/sling/trunk/scripting/jst/src/test/resources/jscode/jscode1.input.jst
    incubator/sling/trunk/scripting/jst/src/test/resources/jscode/jscode2.input.jst

Modified: incubator/sling/trunk/scripting/jst/src/main/java/org/apache/sling/scripting/jst/BodyOnlyScriptFilteredCopy.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/scripting/jst/src/main/java/org/apache/sling/scripting/jst/BodyOnlyScriptFilteredCopy.java?rev=689056&r1=689055&r2=689056&view=diff
==============================================================================
--- incubator/sling/trunk/scripting/jst/src/main/java/org/apache/sling/scripting/jst/BodyOnlyScriptFilteredCopy.java
(original)
+++ incubator/sling/trunk/scripting/jst/src/main/java/org/apache/sling/scripting/jst/BodyOnlyScriptFilteredCopy.java
Tue Aug 26 06:01:28 2008
@@ -31,8 +31,8 @@
     private final Pattern bodyEnd;
     
     BodyOnlyScriptFilteredCopy() {
-        bodyStart = Pattern.compile("^out.write\\(. *<body.*");
-        bodyEnd = Pattern.compile("^out.write\\(. *</body.*");
+        bodyStart = Pattern.compile("^out.write\\(.*<body.*");
+        bodyEnd = Pattern.compile("^out.write\\(.*</body.*");
     }
     
     protected boolean copyLine(String line) {

Modified: incubator/sling/trunk/scripting/jst/src/test/java/org/apache/sling/scripting/jst/BodyOnlyScriptFilteredCopyTest.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/scripting/jst/src/test/java/org/apache/sling/scripting/jst/BodyOnlyScriptFilteredCopyTest.java?rev=689056&r1=689055&r2=689056&view=diff
==============================================================================
--- incubator/sling/trunk/scripting/jst/src/test/java/org/apache/sling/scripting/jst/BodyOnlyScriptFilteredCopyTest.java
(original)
+++ incubator/sling/trunk/scripting/jst/src/test/java/org/apache/sling/scripting/jst/BodyOnlyScriptFilteredCopyTest.java
Tue Aug 26 06:01:28 2008
@@ -74,4 +74,18 @@
         
         runTest(input,expected);
     }
+    
+    public void test_SLING_615() throws IOException {
+        final String input =
+            "out.write(' <meta name='decorator' content='tssdotcom'></head><body>');\n"
+            + "out.write('the body');\n"
+            + "out.write('</body></html>');\n"
+            ;
+        
+        final String expected =
+            "out.write('the body');\n"
+            ;
+        
+        runTest(input,expected);
+    }
 }

Modified: incubator/sling/trunk/scripting/jst/src/test/java/org/apache/sling/scripting/jst/JsCodeGeneratorTest.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/scripting/jst/src/test/java/org/apache/sling/scripting/jst/JsCodeGeneratorTest.java?rev=689056&r1=689055&r2=689056&view=diff
==============================================================================
--- incubator/sling/trunk/scripting/jst/src/test/java/org/apache/sling/scripting/jst/JsCodeGeneratorTest.java
(original)
+++ incubator/sling/trunk/scripting/jst/src/test/java/org/apache/sling/scripting/jst/JsCodeGeneratorTest.java
Tue Aug 26 06:01:28 2008
@@ -54,7 +54,7 @@
         final StringWriter result = new StringWriter();
         generator.generateCode(r, new PrintWriter(result));
         
-        assertEquals("Generated code matches expected code", 
+        assertEquals("Generated code must match expected code for " + input, 
                 TestStringUtil.flatten(expectedCode.toString().trim()), 
                 TestStringUtil.flatten(result.toString().trim())
                 );

Modified: incubator/sling/trunk/scripting/jst/src/test/resources/jscode/jscode1.input.jst
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/scripting/jst/src/test/resources/jscode/jscode1.input.jst?rev=689056&r1=689055&r2=689056&view=diff
==============================================================================
--- incubator/sling/trunk/scripting/jst/src/test/resources/jscode/jscode1.input.jst (original)
+++ incubator/sling/trunk/scripting/jst/src/test/resources/jscode/jscode1.input.jst Tue Aug
26 06:01:28 2008
@@ -1,7 +1,7 @@
 <html>
  <!-- 
  	The currentNode.whatever code must not be output,
- 	JST considers only what's inside <body>
+ 	JST considers only what's inside the body tag
  	for javascript generation
   --> 	
  <%= currentNode.whatever %>

Modified: incubator/sling/trunk/scripting/jst/src/test/resources/jscode/jscode2.input.jst
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/scripting/jst/src/test/resources/jscode/jscode2.input.jst?rev=689056&r1=689055&r2=689056&view=diff
==============================================================================
--- incubator/sling/trunk/scripting/jst/src/test/resources/jscode/jscode2.input.jst (original)
+++ incubator/sling/trunk/scripting/jst/src/test/resources/jscode/jscode2.input.jst Tue Aug
26 06:01:28 2008
@@ -1,6 +1,6 @@
 <html>
  <!-- 
- 	Missing <body> tag, nothing must be output
+ 	Missing body tag, nothing must be output
   --> 	
  <%= currentNode.whatever %>
  <b>This will not generate javascript code</b>



Mime
View raw message