39 javadoc("Error.java", "1 error");
40 javadoc("JavacWarning.java", "1 warning");
41 javadoc("JavadocWarning.java", "1 warning");
42 if (errors > 0)
43 throw new Exception(errors + " errors found");
44 }
45
46 void javadoc(String path, String expect) {
47 File testSrc = new File(System.getProperty("test.src"));
48 String[] args = {
49 "-Xdoclint:none",
50 "-source", "8",
51 "-bootclasspath", System.getProperty("sun.boot.class.path"),
52 "-classpath", ".",
53 "-package",
54 new File(testSrc, path).getPath()
55 };
56
57 StringWriter sw = new StringWriter();
58 PrintWriter pw = new PrintWriter(sw);
59 int rc = com.sun.tools.javadoc.Main.execute(
60 "javadoc",
61 pw, pw, pw,
62 com.sun.tools.doclets.standard.Standard.class.getName(),
63 args);
64 pw.close();
65 String out = sw.toString();
66 if (!out.isEmpty())
67 System.err.println(out);
68 System.err.println("javadoc exit: rc=" + rc);
69
70 if (!out.contains(expect))
71 error("expected text not found: " + expect);
72 }
73
74 void error(String msg) {
75 System.err.println("Error: " + msg);
76 errors++;
77 }
78
79 int errors;
80 }
|
39 javadoc("Error.java", "1 error");
40 javadoc("JavacWarning.java", "1 warning");
41 javadoc("JavadocWarning.java", "1 warning");
42 if (errors > 0)
43 throw new Exception(errors + " errors found");
44 }
45
46 void javadoc(String path, String expect) {
47 File testSrc = new File(System.getProperty("test.src"));
48 String[] args = {
49 "-Xdoclint:none",
50 "-source", "8",
51 "-bootclasspath", System.getProperty("sun.boot.class.path"),
52 "-classpath", ".",
53 "-package",
54 new File(testSrc, path).getPath()
55 };
56
57 StringWriter sw = new StringWriter();
58 PrintWriter pw = new PrintWriter(sw);
59 int rc = jdk.javadoc.internal.tool.Main.execute(args, pw);
60 pw.close();
61 String out = sw.toString();
62 if (!out.isEmpty())
63 System.err.println(out);
64 System.err.println("javadoc exit: rc=" + rc);
65
66 if (!out.contains(expect))
67 error("expected text not found: " + expect);
68 }
69
70 void error(String msg) {
71 System.err.println("Error: " + msg);
72 errors++;
73 }
74
75 int errors;
76 }
|