You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2021/06/02 11:05:15 UTC

[myfaces-tobago] branch master updated: fix: UnitTest under Windows

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

lofwyr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git


The following commit(s) were added to refs/heads/master by this push:
     new a23be4a  fix: UnitTest under Windows
a23be4a is described below

commit a23be4a3a2e6dc8e4ca5c4ccdaca08da976f5648
Author: Udo Schnurpfeil <ud...@irian.eu>
AuthorDate: Wed Jun 2 12:10:45 2021 +0200

    fix: UnitTest under Windows
---
 .../tobago/internal/renderkit/renderer/RendererTestBase.java     | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/tobago-core/src/test/java/org/apache/myfaces/tobago/internal/renderkit/renderer/RendererTestBase.java b/tobago-core/src/test/java/org/apache/myfaces/tobago/internal/renderkit/renderer/RendererTestBase.java
index c1c72ce..132f52b 100644
--- a/tobago-core/src/test/java/org/apache/myfaces/tobago/internal/renderkit/renderer/RendererTestBase.java
+++ b/tobago-core/src/test/java/org/apache/myfaces/tobago/internal/renderkit/renderer/RendererTestBase.java
@@ -31,7 +31,7 @@ import java.util.stream.Collectors;
 public abstract class RendererTestBase extends AbstractTobagoTestBase {
 
   protected String formattedResult() throws IOException {
-    return format1To2Indent(getLastWritten());
+    return formatCrlf2LfAndTrim(format1To2Indent(getLastWritten()));
   }
 
   protected String loadHtml(final String fileName) throws IOException {
@@ -42,9 +42,10 @@ public abstract class RendererTestBase extends AbstractTobagoTestBase {
       }
       try (final InputStreamReader isr = new InputStreamReader(is);
            final BufferedReader reader = new BufferedReader(isr)) {
-        return reader.lines().collect(Collectors.joining(System.lineSeparator()))
+        final String xml = reader.lines().collect(Collectors.joining(System.lineSeparator()))
             .replaceAll("<!--[^>]*-->", "")
             .replaceAll("^\n\n", "");
+        return formatCrlf2LfAndTrim(xml);
       }
     }
   }
@@ -60,4 +61,8 @@ public abstract class RendererTestBase extends AbstractTobagoTestBase {
     .replaceAll("\n       <", "\n\t\t\t\t\t\t\t<")
         .replaceAll("\t", "  ");
   }
+
+  protected String formatCrlf2LfAndTrim(final String xml) {
+    return xml.replaceAll("\r\n", "\n").trim();
+  }
 }