]> source.dussan.org Git - jgit.git/commitdiff
[test] DirCacheCheckoutTest: fix test expectation for eol=native 86/190186/1
authorThomas Wolf <thomas.wolf@paranor.ch>
Sun, 30 Jan 2022 21:47:38 +0000 (22:47 +0100)
committerThomas Wolf <thomas.wolf@paranor.ch>
Sun, 30 Jan 2022 21:47:38 +0000 (22:47 +0100)
With eol=native, we expect LF on Unixes, and CR-LF on Windows. One test
didn't account for this and always expected LF, and thus failed on
Windows.

Bug: 550111
Change-Id: I69354ac691c464d1b6003812ddb4510c5ab5e77a
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/DirCacheCheckoutTest.java

index af8a58f6f079315e451c3b99c24f02f91eb5b1c0..813945adf8d630e16cb01899948f6bcccb0ad7aa 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (C) 2007, Dave Watson <dwatson@mimvista.com>
  * Copyright (C) 2008-2011, Shawn O. Pearce <spearce@spearce.org>
  * Copyright (C) 2008-2011, Robin Rosenberg <robin.rosenberg@dewire.com>
- * Copyright (C) 2010, 2020 Christian Halstrick <christian.halstrick@sap.com> and others
+ * Copyright (C) 2010, 2022 Christian Halstrick <christian.halstrick@sap.com> and others
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Distribution License v. 1.0 which is available at
@@ -313,8 +313,9 @@ public class DirCacheCheckoutTest extends RepositoryTestCase {
 
        @Test
        public void testCheckoutWithLFAuto() throws Exception {
-               checkoutLineEndings("first line\nsecond line\n",
-                               "first line\nsecond line\n", "f text=auto");
+               String expected = String.format("first line%nsecond line%n");
+               checkoutLineEndings("first line\nsecond line\n", expected,
+                               "f text=auto");
        }
 
        @Test
@@ -325,9 +326,9 @@ public class DirCacheCheckoutTest extends RepositoryTestCase {
 
        @Test
        public void testCheckoutWithLFAutoEolNative() throws Exception {
+               String expected = String.format("first line%nsecond line%n");
                checkoutLineEndings(
-                               "first line\nsecond line\n", "first line\nsecond line\n"
-                                               .replaceAll("\n", System.lineSeparator()),
+                               "first line\nsecond line\n", expected,
                                "f text=auto eol=native");
        }