test/tools/javac/doctree/DocCommentTester.java

changeset 1419
a25c53e12bd0
parent 1409
33abf479f202
child 2525
2eb010b6cb22
equal deleted inserted replaced
1418:2531de382983 1419:a25c53e12bd0
174 174
175 /** 175 /**
176 * Verify the structure of the DocTree AST by comparing it against golden text. 176 * Verify the structure of the DocTree AST by comparing it against golden text.
177 */ 177 */
178 static class ASTChecker extends Checker { 178 static class ASTChecker extends Checker {
179 static final String NEWLINE = System.getProperty("line.separator");
179 Printer printer = new Printer(); 180 Printer printer = new Printer();
180 String source; 181 String source;
181 182
182 ASTChecker(DocCommentTester test, DocTrees t) { 183 ASTChecker(DocCommentTester test, DocTrees t) {
183 test.super(t); 184 test.super(t);
195 void check(TreePath path, Name name) { 196 void check(TreePath path, Name name) {
196 StringWriter out = new StringWriter(); 197 StringWriter out = new StringWriter();
197 DocCommentTree dc = trees.getDocCommentTree(path); 198 DocCommentTree dc = trees.getDocCommentTree(path);
198 printer.print(dc, out); 199 printer.print(dc, out);
199 out.flush(); 200 out.flush();
200 String found = out.toString(); 201 String found = out.toString().replace(NEWLINE, "\n");
201 202
202 // Look for the first block comment after the first occurrence of name 203 // Look for the first block comment after the first occurrence of name
203 int start = source.indexOf("\n/*\n", findName(source, name)); 204 int start = source.indexOf("\n/*\n", findName(source, name));
204 int end = source.indexOf("\n*/\n", start); 205 int end = source.indexOf("\n*/\n", start);
205 String expect = source.substring(start + 4, end + 1); 206 String expect = source.substring(start + 4, end + 1);

mercurial