7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 /*
25 * @test
26 * @bug 4934778 4777599 6553182 8146427 8146475 8175055 8185371
27 * @summary Make sure that -help, -helpfile and -nohelp options work correctly.
28 * @author jamieh
29 * @library ../lib
30 * @modules jdk.javadoc/jdk.javadoc.internal.tool
31 * @build JavadocTester TestHelpOption
32 * @run main TestHelpOption
33 */
34
35 import java.util.*;
36 import java.util.stream.*;
37
38 public class TestHelpOption extends JavadocTester {
39
40 public static void main(String... args) throws Exception {
41 TestHelpOption tester = new TestHelpOption();
42 tester.runTests();
43 }
44
45 @Test
46 void testLineLengths() {
47 javadoc("-d", "out1",
49 "-X",
50 testSrc("TestXOption.java"));
51 checkExit(Exit.OK);
52 List<String> longLines = getOutputLines(Output.OUT).stream()
53 .filter(s -> s.length() > 80)
54 .collect(Collectors.toList());
55 checking("line lengths");
56 if (longLines.isEmpty()) {
57 passed("all lines OK");
58 } else {
59 out.println("long lines:");
60 longLines.stream().forEach(s -> out.println(">>>" + s + "<<<"));
61 failed(longLines.size() + " long lines");
62 }
63 }
64
65 @Test
66 void testWithOption() {
67 javadoc("-d", "out1",
68 "-sourcepath", testSrc,
69 "-help",
70 testSrc("Sample.java"));
71 checkExit(Exit.OK);
72
73 checkOutput(true);
74 }
75
76 @Test
77 void testWithoutOption() {
78 javadoc("-d", "out2",
79 "-sourcepath", testSrc,
80 testSrc("Sample.java"));
81 checkExit(Exit.OK);
82 }
83
84 @Test
85 void testNohelpOption() {
86 javadoc("-d", "out3",
87 "-sourcepath", testSrc,
88 "-nohelp",
89 testSrc("Sample.java"));
|
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 /*
25 * @test
26 * @bug 4934778 4777599 6553182 8146427 8146475 8175055 8185371
27 * @summary Make sure that --help, -helpfile and -nohelp options work correctly.
28 * @author jamieh
29 * @library ../lib
30 * @modules jdk.javadoc/jdk.javadoc.internal.tool
31 * @build JavadocTester TestHelpOption
32 * @run main TestHelpOption
33 */
34
35 import java.util.*;
36 import java.util.stream.*;
37
38 public class TestHelpOption extends JavadocTester {
39
40 public static void main(String... args) throws Exception {
41 TestHelpOption tester = new TestHelpOption();
42 tester.runTests();
43 }
44
45 @Test
46 void testLineLengths() {
47 javadoc("-d", "out1",
49 "-X",
50 testSrc("TestXOption.java"));
51 checkExit(Exit.OK);
52 List<String> longLines = getOutputLines(Output.OUT).stream()
53 .filter(s -> s.length() > 80)
54 .collect(Collectors.toList());
55 checking("line lengths");
56 if (longLines.isEmpty()) {
57 passed("all lines OK");
58 } else {
59 out.println("long lines:");
60 longLines.stream().forEach(s -> out.println(">>>" + s + "<<<"));
61 failed(longLines.size() + " long lines");
62 }
63 }
64
65 @Test
66 void testWithOption() {
67 javadoc("-d", "out1",
68 "-sourcepath", testSrc,
69 "--help",
70 testSrc("Sample.java"));
71 checkExit(Exit.OK);
72
73 checkOutput(true);
74 }
75
76 @Test
77 void testWithoutOption() {
78 javadoc("-d", "out2",
79 "-sourcepath", testSrc,
80 testSrc("Sample.java"));
81 checkExit(Exit.OK);
82 }
83
84 @Test
85 void testNohelpOption() {
86 javadoc("-d", "out3",
87 "-sourcepath", testSrc,
88 "-nohelp",
89 testSrc("Sample.java"));
|