From 5ad981be3a96c8be0fd5ab3d01dd5ca828f0b990 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Sch=C3=A4fer?= Date: Fri, 24 Jan 2020 18:30:49 +0100 Subject: [PATCH] Fix tests regarding os specific line endings (#399) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On Windows two tests fail because additional \r chars are being used for new lines. To fix this issue those chars are being removed from exception texts. Signed-off-by: Michael Schäfer --- .../java/org/eclipse/lsp4j/jsonrpc/test/RemoteEndpointTest.java | 2 +- .../src/test/java/org/eclipse/lsp4j/test/LSPEndpointTest.xtend | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/org.eclipse.lsp4j.jsonrpc/src/test/java/org/eclipse/lsp4j/jsonrpc/test/RemoteEndpointTest.java b/org.eclipse.lsp4j.jsonrpc/src/test/java/org/eclipse/lsp4j/jsonrpc/test/RemoteEndpointTest.java index ac991dd52..f27e12043 100644 --- a/org.eclipse.lsp4j.jsonrpc/src/test/java/org/eclipse/lsp4j/jsonrpc/test/RemoteEndpointTest.java +++ b/org.eclipse.lsp4j.jsonrpc/src/test/java/org/eclipse/lsp4j/jsonrpc/test/RemoteEndpointTest.java @@ -213,7 +213,7 @@ public CompletableFuture request(String method, Object parameter) { assertEquals(ResponseErrorCode.InternalError.getValue(), response.getError().getCode()); String exception = (String) response.getError().getData(); String expected = "java.lang.RuntimeException: BAAZ\n\tat org.eclipse.lsp4j.jsonrpc.test.RemoteEndpointTest"; - assertEquals(expected, exception.substring(0, expected.length())); + assertEquals(expected, exception.replaceAll("\\r", "").substring(0, expected.length())); } finally { logMessages.unregister(); } diff --git a/org.eclipse.lsp4j/src/test/java/org/eclipse/lsp4j/test/LSPEndpointTest.xtend b/org.eclipse.lsp4j/src/test/java/org/eclipse/lsp4j/test/LSPEndpointTest.xtend index 3f7ac4416..76b723717 100644 --- a/org.eclipse.lsp4j/src/test/java/org/eclipse/lsp4j/test/LSPEndpointTest.xtend +++ b/org.eclipse.lsp4j/src/test/java/org/eclipse/lsp4j/test/LSPEndpointTest.xtend @@ -72,7 +72,7 @@ class LSPEndpointTest { assertEquals(''' Lists must not contain null references. Path: $.result.contents[0] Lists must not contain null references. Path: $.result.contents[1] - '''.toString.trim, exception.cause.message) + '''.toString.replaceAll("\\r", "").trim, exception.cause.message) assertFalse(future.isDone) } finally { in.close()