29 * @modules jdk.javadoc/jdk.javadoc.internal.tool |
29 * @modules jdk.javadoc/jdk.javadoc.internal.tool |
30 * @build JavadocTester |
30 * @build JavadocTester |
31 * @run main TestXOption |
31 * @run main TestXOption |
32 */ |
32 */ |
33 |
33 |
|
34 import java.util.*; |
|
35 import java.util.stream.*; |
|
36 |
34 public class TestXOption extends JavadocTester { |
37 public class TestXOption extends JavadocTester { |
35 |
38 |
36 public static void main(String... args) throws Exception { |
39 public static void main(String... args) throws Exception { |
37 TestXOption tester = new TestXOption(); |
40 TestXOption tester = new TestXOption(); |
38 tester.runTests(); |
41 tester.runTests(); |
|
42 } |
|
43 |
|
44 @Test |
|
45 void testLineLengths() { |
|
46 javadoc("-d", "out1", |
|
47 "-sourcepath", testSrc, |
|
48 "-X", |
|
49 testSrc("TestXOption.java")); |
|
50 checkExit(Exit.OK); |
|
51 List<String> longLines = getOutputLines(Output.OUT).stream() |
|
52 .filter(s -> s.length() > 80) |
|
53 .collect(Collectors.toList()); |
|
54 checking("line lengths"); |
|
55 if (longLines.isEmpty()) { |
|
56 passed("all lines OK"); |
|
57 } else { |
|
58 out.println("long lines:"); |
|
59 longLines.stream().forEach(s -> out.println(">>>" + s + "<<<")); |
|
60 failed(longLines.size() + " long lines"); |
|
61 } |
39 } |
62 } |
40 |
63 |
41 @Test |
64 @Test |
42 void testWithOption() { |
65 void testWithOption() { |
43 javadoc("-d", "out1", |
66 javadoc("-d", "out1", |
56 checkExit(Exit.OK); |
79 checkExit(Exit.OK); |
57 checkOutput(false); |
80 checkOutput(false); |
58 } |
81 } |
59 |
82 |
60 private void checkOutput(boolean expectFound) { |
83 private void checkOutput(boolean expectFound) { |
61 // TODO: It's an ugly hidden side-effect of the current doclet API |
|
62 // that the -X output from the tool and the -X output from the doclet |
|
63 // come out on different streams! |
|
64 // When we clean up the doclet API, this should be rationalized. |
|
65 checkOutput(Output.OUT, expectFound, |
84 checkOutput(Output.OUT, expectFound, |
66 "-Xmaxerrs ", |
85 "-Xmaxerrs ", |
67 "-Xmaxwarns "); |
86 "-Xmaxwarns ", |
68 checkOutput(Output.OUT, expectFound, |
|
69 "-Xdocrootparent ", |
87 "-Xdocrootparent ", |
70 "-Xdoclint ", |
88 "-Xdoclint ", |
71 "-Xdoclint:"); |
89 "-Xdoclint:"); |
72 } |
90 } |
73 } |
91 } |