提交 4a12979b 编写于 作者: K ksrini

7119487: JavacParserTest.java test fails on Windows platforms

Reviewed-by: jjg
上级 f09d757f
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
* @test * @test
* @bug 7073631 * @bug 7073631
* @summary tests error and diagnostics positions * @summary tests error and diagnostics positions
* @author jan.lahoda@oracle.com * @author Jan Lahoda
*/ */
import com.sun.source.tree.BinaryTree; import com.sun.source.tree.BinaryTree;
...@@ -83,6 +83,12 @@ public class JavacParserTest extends TestCase { ...@@ -83,6 +83,12 @@ public class JavacParserTest extends TestCase {
return text; return text;
} }
} }
/*
* converts Windows to Unix style LFs for comparing strings
*/
private String normalize(String in) {
return in.replace(System.getProperty("line.separator"), "\n");
}
public CompilationUnitTree getCompilationUnitTree(String code) throws IOException { public CompilationUnitTree getCompilationUnitTree(String code) throws IOException {
...@@ -95,9 +101,7 @@ public class JavacParserTest extends TestCase { ...@@ -95,9 +101,7 @@ public class JavacParserTest extends TestCase {
public List<String> getErroneousTreeValues(ErroneousTree node) { public List<String> getErroneousTreeValues(ErroneousTree node) {
List<String> values = new ArrayList<>(); List<String> values = new ArrayList<>();
if (node.getErrorTrees() != null) { if (node.getErrorTrees() != null) {
for (Tree t : node.getErrorTrees()) { for (Tree t : node.getErrorTrees()) {
values.add(t.toString()); values.add(t.toString());
} }
...@@ -786,7 +790,7 @@ public class JavacParserTest extends TestCase { ...@@ -786,7 +790,7 @@ public class JavacParserTest extends TestCase {
@Override @Override
public Void visitErroneous(ErroneousTree node, Void p) { public Void visitErroneous(ErroneousTree node, Void p) {
values.add(getErroneousTreeValues(node).toString()); values.add(normalize(getErroneousTreeValues(node).toString()));
return null; return null;
} }
}.scan(cut, null); }.scan(cut, null);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册