Mercurial > hg > graal-compiler
changeset 17348:0ba1a6745070
unittest: fix newline issue on windows
author | Bernhard Urban <bernhard.urban@jku.at> |
---|---|
date | Mon, 06 Oct 2014 04:50:44 -0700 |
parents | 63780e37b7b9 |
children | d45951ac3ce9 |
files | graal/com.oracle.graal.debug.test/src/com/oracle/graal/debug/test/DebugHistogramTest.java |
diffstat | 1 files changed, 7 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- 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]);