10
|
1 |
/*
|
|
2 |
* Copyright 2003-2004 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
|
20 |
* CA 95054 USA or visit www.sun.com if you need additional information or
|
|
21 |
* have any questions.
|
|
22 |
*/
|
|
23 |
|
|
24 |
/*
|
|
25 |
* @test
|
|
26 |
* @bug 4934778 4777599
|
|
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
|
|
32 |
* @build TestHelpOption
|
|
33 |
* @run main TestHelpOption
|
|
34 |
*/
|
|
35 |
|
|
36 |
public class TestHelpOption extends JavadocTester {
|
|
37 |
|
|
38 |
//Test information.
|
|
39 |
private static final String BUG_ID = "4934778-4777599";
|
|
40 |
|
|
41 |
//Javadoc arguments.
|
|
42 |
private static final String[] ARGS = new String[] {
|
|
43 |
"-d", BUG_ID, "-sourcepath", SRC_DIR, "-help",
|
|
44 |
SRC_DIR + FS + "TestHelpOption.java"
|
|
45 |
};
|
|
46 |
|
|
47 |
private static final String[] ARGS2 = new String[] {
|
|
48 |
"-d", BUG_ID, "-sourcepath", SRC_DIR,
|
|
49 |
SRC_DIR + FS + "TestHelpOption.java"
|
|
50 |
};
|
|
51 |
|
|
52 |
private static final String[][] TEST = {
|
|
53 |
{STANDARD_OUTPUT, "-d "},
|
|
54 |
{STANDARD_OUTPUT, "-use "},
|
|
55 |
{STANDARD_OUTPUT, "-version "},
|
|
56 |
{STANDARD_OUTPUT, "-author "},
|
|
57 |
{STANDARD_OUTPUT, "-docfilessubdirs "},
|
|
58 |
{STANDARD_OUTPUT, "-splitindex "},
|
|
59 |
{STANDARD_OUTPUT, "-windowtitle "},
|
|
60 |
{STANDARD_OUTPUT, "-doctitle "},
|
|
61 |
{STANDARD_OUTPUT, "-header "},
|
|
62 |
{STANDARD_OUTPUT, "-footer "},
|
|
63 |
{STANDARD_OUTPUT, "-bottom "},
|
|
64 |
{STANDARD_OUTPUT, "-link "},
|
|
65 |
{STANDARD_OUTPUT, "-linkoffline "},
|
|
66 |
{STANDARD_OUTPUT, "-excludedocfilessubdir "},
|
|
67 |
{STANDARD_OUTPUT, "-group "},
|
|
68 |
{STANDARD_OUTPUT, "-nocomment "},
|
|
69 |
{STANDARD_OUTPUT, "-nodeprecated "},
|
|
70 |
{STANDARD_OUTPUT, "-noqualifier "},
|
|
71 |
{STANDARD_OUTPUT, "-nosince "},
|
|
72 |
{STANDARD_OUTPUT, "-notimestamp "},
|
|
73 |
{STANDARD_OUTPUT, "-nodeprecatedlist "},
|
|
74 |
{STANDARD_OUTPUT, "-notree "},
|
|
75 |
{STANDARD_OUTPUT, "-noindex "},
|
|
76 |
{STANDARD_OUTPUT, "-nohelp "},
|
|
77 |
{STANDARD_OUTPUT, "-nonavbar "},
|
|
78 |
{STANDARD_OUTPUT, "-serialwarn "},
|
|
79 |
{STANDARD_OUTPUT, "-tag "},
|
|
80 |
{STANDARD_OUTPUT, "-taglet "},
|
|
81 |
{STANDARD_OUTPUT, "-tagletpath "},
|
|
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;
|
|
91 |
|
|
92 |
private static final String[][] TEST2 = {
|
|
93 |
{BUG_ID + FS + "TestHelpOption.html",
|
|
94 |
"<A HREF=\"help-doc.html\"><FONT CLASS=\"NavBarFont1\">" +
"<B>Help</B></FONT></A>"
|
|
95 |
},
|
|
96 |
};
|
|
97 |
private static final String[][] NEGATED_TEST2 = NO_TEST;
|
|
98 |
|
|
99 |
//The help option should not crash the doclet.
|
|
100 |
private static final int EXPECTED_EXIT_CODE = 0;
|
|
101 |
|
|
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 |
}
|
|
113 |
|
|
114 |
/**
|
|
115 |
* {@inheritDoc}
|
|
116 |
*/
|
|
117 |
public String getBugId() {
|
|
118 |
return BUG_ID;
|
|
119 |
}
|
|
120 |
|
|
121 |
/**
|
|
122 |
* {@inheritDoc}
|
|
123 |
*/
|
|
124 |
public String getBugName() {
|
|
125 |
return getClass().getName();
|
|
126 |
}
|
|
127 |
}
|