Wed, 08 Oct 2014 14:16:40 -0700
Merge
1 /*
2 * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
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 */
24 /*
25 * @test
26 * @bug 4934778 4777599 6553182
27 * @summary Make sure that the -help option works properly. Make sure
28 * the help link appears in the documentation.
29 * @author jamieh
30 * @library ../lib/
31 * @build JavadocTester TestHelpOption
32 * @run main TestHelpOption
33 */
35 public class TestHelpOption extends JavadocTester {
37 //Test information.
38 private static final String BUG_ID = "4934778-4777599-6553182";
40 //Javadoc arguments.
41 private static final String[] ARGS = new String[] {
42 "-d", BUG_ID, "-sourcepath", SRC_DIR, "-help",
43 SRC_DIR + FS + "TestHelpOption.java"
44 };
46 private static final String[] ARGS2 = new String[] {
47 "-d", BUG_ID, "-sourcepath", SRC_DIR,
48 SRC_DIR + FS + "TestHelpOption.java"
49 };
51 private static final String[][] TEST = {
52 {STANDARD_OUTPUT, "-d "},
53 {STANDARD_OUTPUT, "-use "},
54 {STANDARD_OUTPUT, "-version "},
55 {STANDARD_OUTPUT, "-author "},
56 {STANDARD_OUTPUT, "-docfilessubdirs "},
57 {STANDARD_OUTPUT, "-splitindex "},
58 {STANDARD_OUTPUT, "-windowtitle "},
59 {STANDARD_OUTPUT, "-doctitle "},
60 {STANDARD_OUTPUT, "-header "},
61 {STANDARD_OUTPUT, "-footer "},
62 {STANDARD_OUTPUT, "-bottom "},
63 {STANDARD_OUTPUT, "-link "},
64 {STANDARD_OUTPUT, "-linkoffline "},
65 {STANDARD_OUTPUT, "-excludedocfilessubdir "},
66 {STANDARD_OUTPUT, "-group "},
67 {STANDARD_OUTPUT, "-nocomment "},
68 {STANDARD_OUTPUT, "-nodeprecated "},
69 {STANDARD_OUTPUT, "-noqualifier "},
70 {STANDARD_OUTPUT, "-nosince "},
71 {STANDARD_OUTPUT, "-notimestamp "},
72 {STANDARD_OUTPUT, "-nodeprecatedlist "},
73 {STANDARD_OUTPUT, "-notree "},
74 {STANDARD_OUTPUT, "-noindex "},
75 {STANDARD_OUTPUT, "-nohelp "},
76 {STANDARD_OUTPUT, "-nonavbar "},
77 {STANDARD_OUTPUT, "-serialwarn "},
78 {STANDARD_OUTPUT, "-tag "},
79 {STANDARD_OUTPUT, "-taglet "},
80 {STANDARD_OUTPUT, "-tagletpath "},
81 {STANDARD_OUTPUT, "-charset "},
82 {STANDARD_OUTPUT, "-helpfile "},
83 {STANDARD_OUTPUT, "-linksource "},
84 {STANDARD_OUTPUT, "-sourcetab "},
85 {STANDARD_OUTPUT, "-keywords "},
86 {STANDARD_OUTPUT, "-stylesheetfile "},
87 {STANDARD_OUTPUT, "-docencoding "},
88 };
89 private static final String[][] NEGATED_TEST = NO_TEST;
91 private static final String[][] TEST2 = {
92 {BUG_ID + FS + "TestHelpOption.html",
93 "<li><a href=\"help-doc.html\">Help</a></li>"
94 },
95 };
96 private static final String[][] NEGATED_TEST2 = NO_TEST;
98 //The help option should not crash the doclet.
99 private static final int EXPECTED_EXIT_CODE = 0;
101 /**
102 * The entry point of the test.
103 * @param args the array of command line arguments.
104 */
105 public static void main(String[] args) {
106 TestHelpOption tester = new TestHelpOption();
107 int actualExitCode = run(tester, ARGS, TEST, NEGATED_TEST);
108 tester.checkExitCode(EXPECTED_EXIT_CODE, actualExitCode);
109 run(tester, ARGS2, TEST2, NEGATED_TEST2);
110 tester.printSummary();
111 }
113 /**
114 * {@inheritDoc}
115 */
116 public String getBugId() {
117 return BUG_ID;
118 }
120 /**
121 * {@inheritDoc}
122 */
123 public String getBugName() {
124 return getClass().getName();
125 }
126 }