Mercurial > people > rkennke > jdk9-shenandoah-final > nashorn
changeset 529:3bd077423a08
8022773: ScriptEngineTest.printManyTest fails
Reviewed-by: lagergren, attila
author | sundar |
---|---|
date | Tue, 27 Aug 2013 15:54:45 +0530 |
parents | 99e48c76d11f |
children | 47f0a4c4b729 |
files | test/src/jdk/nashorn/api/scripting/ScriptEngineTest.java |
diffstat | 1 files changed, 12 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/test/src/jdk/nashorn/api/scripting/ScriptEngineTest.java Mon Aug 26 15:33:40 2013 -0300 +++ b/test/src/jdk/nashorn/api/scripting/ScriptEngineTest.java Tue Aug 27 15:54:45 2013 +0530 @@ -30,6 +30,7 @@ import static org.testng.Assert.assertTrue; import static org.testng.Assert.fail; +import java.io.PrintWriter; import java.io.StringReader; import java.io.StringWriter; import java.lang.reflect.Method; @@ -400,8 +401,7 @@ exp.printStackTrace(); fail(exp.getMessage()); } - // dos2unix - fix line endings if running on windows - assertEquals(sw.toString().replaceAll("\r", ""), "hello world\n"); + assertEquals(sw.toString(), println("hello world")); } @Test @@ -490,8 +490,7 @@ fail(t.getMessage()); } - // dos2unix - fix line endings if running on windows - assertEquals(sw.toString().replaceAll("\r", ""), "hello\n"); + assertEquals(sw.toString(), println("hello")); } @Test @@ -508,7 +507,14 @@ fail(t.getMessage()); } - // dos2unix - fix line endings if running on windows - assertEquals(sw.toString().replaceAll("\r", ""), "34 true hello\n"); + assertEquals(sw.toString(), println("34 true hello")); + } + + private static final String LINE_SEPARATOR = System.getProperty("line.separator"); + + // Returns String that would be the result of calling PrintWriter.println + // of the given String. (This is to handle platform specific newline). + private static String println(final String str) { + return str + LINE_SEPARATOR; } }