Wed, 28 Nov 2012 14:07:26 -0800
Merge
1 /*
2 * Copyright (c) 2003, 2011, 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, "-Xdocrootparent "},
82 {STANDARD_OUTPUT, "-charset "},
83 {STANDARD_OUTPUT, "-helpfile "},
84 {STANDARD_OUTPUT, "-linksource "},
85 {STANDARD_OUTPUT, "-sourcetab "},
86 {STANDARD_OUTPUT, "-keywords "},
87 {STANDARD_OUTPUT, "-stylesheetfile "},
88 {STANDARD_OUTPUT, "-docencoding "},
89 };
90 private static final String[][] NEGATED_TEST = NO_TEST;
92 private static final String[][] TEST2 = {
93 {BUG_ID + FS + "TestHelpOption.html",
94 "<li><a href=\"help-doc.html\">Help</a></li>"
95 },
96 };
97 private static final String[][] NEGATED_TEST2 = NO_TEST;
99 //The help option should not crash the doclet.
100 private static final int EXPECTED_EXIT_CODE = 0;
102 /**
103 * The entry point of the test.
104 * @param args the array of command line arguments.
105 */
106 public static void main(String[] args) {
107 TestHelpOption tester = new TestHelpOption();
108 int actualExitCode = run(tester, ARGS, TEST, NEGATED_TEST);
109 tester.checkExitCode(EXPECTED_EXIT_CODE, actualExitCode);
110 run(tester, ARGS2, TEST2, NEGATED_TEST2);
111 tester.printSummary();
112 }
114 /**
115 * {@inheritDoc}
116 */
117 public String getBugId() {
118 return BUG_ID;
119 }
121 /**
122 * {@inheritDoc}
123 */
124 public String getBugName() {
125 return getClass().getName();
126 }
127 }