Skip to content

Commit 5ad981b

Browse files
mschaefer88jonahgraham
authored andcommitted
Fix tests regarding os specific line endings (#399)
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 <[email protected]>
1 parent 4e476ba commit 5ad981b

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

org.eclipse.lsp4j.jsonrpc/src/test/java/org/eclipse/lsp4j/jsonrpc/test/RemoteEndpointTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ public CompletableFuture<Object> request(String method, Object parameter) {
213213
assertEquals(ResponseErrorCode.InternalError.getValue(), response.getError().getCode());
214214
String exception = (String) response.getError().getData();
215215
String expected = "java.lang.RuntimeException: BAAZ\n\tat org.eclipse.lsp4j.jsonrpc.test.RemoteEndpointTest";
216-
assertEquals(expected, exception.substring(0, expected.length()));
216+
assertEquals(expected, exception.replaceAll("\\r", "").substring(0, expected.length()));
217217
} finally {
218218
logMessages.unregister();
219219
}

org.eclipse.lsp4j/src/test/java/org/eclipse/lsp4j/test/LSPEndpointTest.xtend

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class LSPEndpointTest {
7272
assertEquals('''
7373
Lists must not contain null references. Path: $.result.contents[0]
7474
Lists must not contain null references. Path: $.result.contents[1]
75-
'''.toString.trim, exception.cause.message)
75+
'''.toString.replaceAll("\\r", "").trim, exception.cause.message)
7676
assertFalse(future.isDone)
7777
} finally {
7878
in.close()

0 commit comments

Comments
 (0)