From: Thomas Wolf Date: Sun, 30 Jan 2022 21:47:38 +0000 (+0100) Subject: [test] DirCacheCheckoutTest: fix test expectation for eol=native X-Git-Tag: v6.1.0.202202221755-m3~37 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=8633ea4f07cbe10706a9edd1301f13aebe5be942;p=jgit.git [test] DirCacheCheckoutTest: fix test expectation for eol=native 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 --- diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/DirCacheCheckoutTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/DirCacheCheckoutTest.java index af8a58f6f0..813945adf8 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/DirCacheCheckoutTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/DirCacheCheckoutTest.java @@ -2,7 +2,7 @@ * Copyright (C) 2007, Dave Watson * Copyright (C) 2008-2011, Shawn O. Pearce * Copyright (C) 2008-2011, Robin Rosenberg - * Copyright (C) 2010, 2020 Christian Halstrick and others + * Copyright (C) 2010, 2022 Christian Halstrick 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"); }