diff --git a/android/guava-tests/test/com/google/common/base/ThrowablesTest.java b/android/guava-tests/test/com/google/common/base/ThrowablesTest.java index 363550a16e59..3c0047ad71b2 100644 --- a/android/guava-tests/test/com/google/common/base/ThrowablesTest.java +++ b/android/guava-tests/test/com/google/common/base/ThrowablesTest.java @@ -658,9 +658,6 @@ static void methodThatThrowsUndeclaredChecked() throws SomeUndeclaredCheckedExce @J2ktIncompatible @GwtIncompatible // getStackTraceAsString(Throwable) public void testGetStackTraceAsString() { - if (isWindows()) { - return; // TODO: b/136041958 - We probably just need to accept \r\n line delimiters. - } class StackTraceException extends Exception { StackTraceException(String message) { super(message); @@ -671,8 +668,8 @@ class StackTraceException extends Exception { String firstLine = quote(e.getClass().getName() + ": " + e.getMessage()); String secondLine = "\\s*at " + ThrowablesTest.class.getName() + "\\..*"; - String moreLines = "(?:.*\n?)*"; - String expected = firstLine + "\n" + secondLine + "\n" + moreLines; + String moreLines = "(?:.*" + System.lineSeparator() + "?)*"; + String expected = String.join(System.lineSeparator(), firstLine, secondLine, moreLines); assertThat(getStackTraceAsString(e)).matches(expected); } @@ -792,8 +789,4 @@ private void doTestLazyStackTraceFallback() { public void testNullPointers() { new NullPointerTester().testAllPublicStaticMethods(Throwables.class); } - - private static boolean isWindows() { - return OS_NAME.value().startsWith("Windows"); - } } diff --git a/android/guava-tests/test/com/google/common/io/ResourcesTest.java b/android/guava-tests/test/com/google/common/io/ResourcesTest.java index 23a487530a33..2aefe7c174d8 100644 --- a/android/guava-tests/test/com/google/common/io/ResourcesTest.java +++ b/android/guava-tests/test/com/google/common/io/ResourcesTest.java @@ -160,10 +160,7 @@ public void testGetResource_contextClassLoader() throws IOException { Thread.currentThread().setContextClassLoader(loader); URL url = Resources.getResource(tempFile.getName()); String text = Resources.toString(url, Charsets.UTF_8); - if (isWindows()) { - return; // TODO: b/136041958 - We probably just need to accept \r\n line delimiters. - } - assertEquals("rud a chur ar an méar fhada\n", text); + assertEquals("rud a chur ar an méar fhada" + System.lineSeparator(), text); } finally { Thread.currentThread().setContextClassLoader(oldContextLoader); } @@ -194,8 +191,4 @@ public void testNulls() { private static URL classfile(Class c) { return c.getResource(c.getSimpleName() + ".class"); } - - private static boolean isWindows() { - return OS_NAME.value().startsWith("Windows"); - } } diff --git a/guava-tests/test/com/google/common/base/ThrowablesTest.java b/guava-tests/test/com/google/common/base/ThrowablesTest.java index 363550a16e59..3c0047ad71b2 100644 --- a/guava-tests/test/com/google/common/base/ThrowablesTest.java +++ b/guava-tests/test/com/google/common/base/ThrowablesTest.java @@ -658,9 +658,6 @@ static void methodThatThrowsUndeclaredChecked() throws SomeUndeclaredCheckedExce @J2ktIncompatible @GwtIncompatible // getStackTraceAsString(Throwable) public void testGetStackTraceAsString() { - if (isWindows()) { - return; // TODO: b/136041958 - We probably just need to accept \r\n line delimiters. - } class StackTraceException extends Exception { StackTraceException(String message) { super(message); @@ -671,8 +668,8 @@ class StackTraceException extends Exception { String firstLine = quote(e.getClass().getName() + ": " + e.getMessage()); String secondLine = "\\s*at " + ThrowablesTest.class.getName() + "\\..*"; - String moreLines = "(?:.*\n?)*"; - String expected = firstLine + "\n" + secondLine + "\n" + moreLines; + String moreLines = "(?:.*" + System.lineSeparator() + "?)*"; + String expected = String.join(System.lineSeparator(), firstLine, secondLine, moreLines); assertThat(getStackTraceAsString(e)).matches(expected); } @@ -792,8 +789,4 @@ private void doTestLazyStackTraceFallback() { public void testNullPointers() { new NullPointerTester().testAllPublicStaticMethods(Throwables.class); } - - private static boolean isWindows() { - return OS_NAME.value().startsWith("Windows"); - } } diff --git a/guava-tests/test/com/google/common/io/ResourcesTest.java b/guava-tests/test/com/google/common/io/ResourcesTest.java index 23a487530a33..2aefe7c174d8 100644 --- a/guava-tests/test/com/google/common/io/ResourcesTest.java +++ b/guava-tests/test/com/google/common/io/ResourcesTest.java @@ -160,10 +160,7 @@ public void testGetResource_contextClassLoader() throws IOException { Thread.currentThread().setContextClassLoader(loader); URL url = Resources.getResource(tempFile.getName()); String text = Resources.toString(url, Charsets.UTF_8); - if (isWindows()) { - return; // TODO: b/136041958 - We probably just need to accept \r\n line delimiters. - } - assertEquals("rud a chur ar an méar fhada\n", text); + assertEquals("rud a chur ar an méar fhada" + System.lineSeparator(), text); } finally { Thread.currentThread().setContextClassLoader(oldContextLoader); } @@ -194,8 +191,4 @@ public void testNulls() { private static URL classfile(Class c) { return c.getResource(c.getSimpleName() + ".class"); } - - private static boolean isWindows() { - return OS_NAME.value().startsWith("Windows"); - } }