freemarker-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ddek...@apache.org
Subject [1/4] incubator-freemarker git commit: FREEMARKER-3: fixing unit tests - env issues on OSX or non-Windows systems
Date Fri, 16 Oct 2015 19:27:44 GMT
Repository: incubator-freemarker
Updated Branches:
  refs/heads/master aa716c59b -> eed6d9419


FREEMARKER-3: fixing unit tests - env issues on OSX or non-Windows systems


Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/76c56a59
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/76c56a59
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/76c56a59

Branch: refs/heads/master
Commit: 76c56a59abca3799409329b244a328b31e754a6b
Parents: 0eccad5
Author: Woonsan Ko <woonsan@apache.org>
Authored: Mon Oct 12 22:04:13 2015 +0900
Committer: Woonsan Ko <woonsan@apache.org>
Committed: Mon Oct 12 22:04:13 2015 +0900

----------------------------------------------------------------------
 .../java/freemarker/cache/FileTemplateLoaderTest.java     |  2 +-
 src/test/java/freemarker/test/utility/FileTestCase.java   | 10 +++++++---
 2 files changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/76c56a59/src/test/java/freemarker/cache/FileTemplateLoaderTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/freemarker/cache/FileTemplateLoaderTest.java b/src/test/java/freemarker/cache/FileTemplateLoaderTest.java
index 9088c9d..9539d68 100644
--- a/src/test/java/freemarker/cache/FileTemplateLoaderTest.java
+++ b/src/test/java/freemarker/cache/FileTemplateLoaderTest.java
@@ -92,7 +92,7 @@ public class FileTemplateLoaderTest {
                 ((FileTemplateLoader) cfg.getTemplateLoader()).setEmulateCaseSensitiveFileSystem(emuCaseSensFS);
                 cfg.clearTemplateCache();
                 
-                if (SystemUtils.IS_OS_WINDOWS && !emuCaseSensFS) {
+                if ((SystemUtils.IS_OS_WINDOWS || SystemUtils.IS_OS_MAC_OSX) && !emuCaseSensFS)
{
                     assertEquals("foo", cfg.getTemplate(nameWithBadCase).toString());
                 } else {
                     assertEquals("foo", cfg.getTemplate(nameWithBadCase.toLowerCase()).toString());

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/76c56a59/src/test/java/freemarker/test/utility/FileTestCase.java
----------------------------------------------------------------------
diff --git a/src/test/java/freemarker/test/utility/FileTestCase.java b/src/test/java/freemarker/test/utility/FileTestCase.java
index c0ea3a5..e2d8938 100644
--- a/src/test/java/freemarker/test/utility/FileTestCase.java
+++ b/src/test/java/freemarker/test/utility/FileTestCase.java
@@ -87,8 +87,8 @@ public abstract class FileTestCase extends TestCase {
     }
 
     private void multilineAssertEquals(String expected, String actual) {
-        String normExpected = normalizeNewLines(expected);
-        final String normActual = normalizeNewLines(actual);
+        String normExpected = normalizeNewLineLiterals(normalizeNewLines(expected));
+        final String normActual = normalizeNewLineLiterals(normalizeNewLines(actual));
         
         // Ignore final line-break difference:
         if (normActual.endsWith("\n") && !normExpected.endsWith("\n")) {
@@ -99,7 +99,11 @@ public abstract class FileTestCase extends TestCase {
         
         assertEquals(normExpected, normActual);
     }
-    
+
+    private String normalizeNewLineLiterals(String s) {
+        return StringUtil.replace(s, "\\r\\n", "\\n");
+    }
+
     private String normalizeNewLines(String s) {
         return StringUtil.replace(s, "\r\n", "\n").replace('\r', '\n');
     }


Mime
View raw message