# HG changeset patch # User Bernhard Urban # Date 1412596244 25200 # Node ID 0ba1a67450705ba5a6818fe891e11ec8074a8987 # Parent 63780e37b7b9d5d9d845464e3a955bc39b77f448 unittest: fix newline issue on windows diff -r 63780e37b7b9 -r 0ba1a6745070 graal/com.oracle.graal.debug.test/src/com/oracle/graal/debug/test/DebugHistogramTest.java --- a/graal/com.oracle.graal.debug.test/src/com/oracle/graal/debug/test/DebugHistogramTest.java Mon Oct 06 14:49:14 2014 +0200 +++ b/graal/com.oracle.graal.debug.test/src/com/oracle/graal/debug/test/DebugHistogramTest.java Mon Oct 06 04:50:44 2014 -0700 @@ -37,7 +37,8 @@ ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); new DebugHistogramAsciiPrinter(new PrintStream(outputStream)).print(histogram); - Assert.assertEquals("TestHistogram is empty.\n", outputStream.toString()); + String line = outputStream.toString().split("\r?\n")[0]; + Assert.assertEquals("TestHistogram is empty.", line); outputStream.reset(); new DebugHistogramRPrinter(new PrintStream(outputStream)).print(histogram); @@ -51,7 +52,7 @@ histogram.add(new Integer(1)); histogram.add(new Integer(1)); new DebugHistogramAsciiPrinter(new PrintStream(outputStream)).print(histogram); - String[] lines = outputStream.toString().split("\n"); + String[] lines = outputStream.toString().split("\r?\n"); // @formatter:off String[] expected = { "TestHistogram has 1 unique elements and 2 total elements:", @@ -64,7 +65,7 @@ outputStream.reset(); new DebugHistogramRPrinter(new PrintStream(outputStream)).print(histogram); - lines = outputStream.toString().split("\n"); + lines = outputStream.toString().split("\r?\n"); // @formatter:off expected = new String[] { "TestHistogram <- c(2);", @@ -82,7 +83,7 @@ histogram.add(new Integer(2)); histogram.add(new Integer(2)); new DebugHistogramAsciiPrinter(new PrintStream(outputStream)).print(histogram); - String[] lines = outputStream.toString().split("\n"); + String[] lines = outputStream.toString().split("\r?\n"); // @formatter:off String[] expected = new String[] { "TestHistogram has 2 unique elements and 3 total elements:", @@ -96,7 +97,7 @@ outputStream.reset(); new DebugHistogramRPrinter(new PrintStream(outputStream)).print(histogram); - lines = outputStream.toString().split("\n"); + lines = outputStream.toString().split("\r?\n"); // @formatter:off expected = new String[] { "TestHistogram <- c(2, 1);", @@ -112,7 +113,7 @@ ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); histogram.add("MyCustomValue"); new DebugHistogramAsciiPrinter(new PrintStream(outputStream), Integer.MAX_VALUE, 10, 10, 1).print(histogram); - String[] lines = outputStream.toString().split("\n"); + String[] lines = outputStream.toString().split("\r?\n"); Assert.assertEquals(4, lines.length); Assert.assertEquals("TestHistogram has 1 unique elements and 1 total elements:", lines[0]); Assert.assertEquals("----------------------------------------", lines[1]);