You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ss...@apache.org on 2017/12/04 10:32:47 UTC

[sling-org-apache-sling-scripting-sightly-compiler-java] branch master updated: fix unit test to make it run on windows machines as well

This is an automated email from the ASF dual-hosted git repository.

sseifert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-sightly-compiler-java.git


The following commit(s) were added to refs/heads/master by this push:
     new ad9b27c  fix unit test to make it run on windows machines as well
ad9b27c is described below

commit ad9b27c13b3bbca1df4a901a2b9985b87d4f7f74
Author: sseifert <ss...@pro-vision.de>
AuthorDate: Mon Dec 4 11:32:40 2017 +0100

    fix unit test to make it run on windows machines as well
---
 .../sightly/compiler/java/JavaClassBackendCompilerTest.java        | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/test/java/org/apache/sling/scripting/sightly/compiler/java/JavaClassBackendCompilerTest.java b/src/test/java/org/apache/sling/scripting/sightly/compiler/java/JavaClassBackendCompilerTest.java
index 73ce0a8..8bac5aa 100644
--- a/src/test/java/org/apache/sling/scripting/sightly/compiler/java/JavaClassBackendCompilerTest.java
+++ b/src/test/java/org/apache/sling/scripting/sightly/compiler/java/JavaClassBackendCompilerTest.java
@@ -24,6 +24,7 @@ import javax.script.Bindings;
 import javax.script.SimpleBindings;
 
 import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.sling.scripting.sightly.compiler.CompilationUnit;
 import org.apache.sling.scripting.sightly.compiler.SightlyCompiler;
 import org.apache.sling.scripting.sightly.compiler.java.utils.CharSequenceJavaCompiler;
@@ -102,11 +103,15 @@ public class JavaClassBackendCompilerTest {
         ClassInfo classInfo = buildClassInfo("imports");
         String source = backendCompiler.build(classInfo);
         String expectedJavaOutput = IOUtils.toString(this.getClass().getResourceAsStream("/imports.html.java"), "UTF-8");
-        assertEquals(expectedJavaOutput, source);
+        assertEquals(normalizeLineEndings(expectedJavaOutput), normalizeLineEndings(source));
         ClassLoader classLoader = JavaClassBackendCompilerTest.class.getClassLoader();
         CharSequenceJavaCompiler<RenderUnit> compiler = new CharSequenceJavaCompiler<>(classLoader, null);
         compiler.compile(classInfo.getFullyQualifiedClassName(), source);
     }
+    
+    private static final String normalizeLineEndings(String input) {
+        return StringUtils.replaceAll(input, "\r\n", "\n");
+    }
 
     private ClassInfo buildClassInfo(final String info) {
         return new ClassInfo() {

-- 
To stop receiving notification emails like this one, please contact
['"commits@sling.apache.org" <co...@sling.apache.org>'].