TestHelpOption.java revision 2375:adf34d48dc1f
1239310Sdim/*
2239310Sdim * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
3239310Sdim * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4239310Sdim *
5239310Sdim * This code is free software; you can redistribute it and/or modify it
6239310Sdim * under the terms of the GNU General Public License version 2 only, as
7239310Sdim * published by the Free Software Foundation.
8239310Sdim *
9239310Sdim * This code is distributed in the hope that it will be useful, but WITHOUT
10239310Sdim * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11239310Sdim * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12239310Sdim * version 2 for more details (a copy is included in the LICENSE file that
13239310Sdim * accompanied this code).
14239310Sdim *
15239310Sdim * You should have received a copy of the GNU General Public License version
16239310Sdim * 2 along with this work; if not, write to the Free Software Foundation,
17239310Sdim * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18239310Sdim *
19239310Sdim * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20239310Sdim * or visit www.oracle.com if you need additional information or have any
21239310Sdim * questions.
22239310Sdim */
23239310Sdim
24239310Sdim/*
25251662Sdim * @test
26251662Sdim * @bug      4934778 4777599 6553182
27251662Sdim * @summary  Make sure that the -help option works properly.  Make sure
28239310Sdim *           the help link appears in the documentation.
29239310Sdim * @author   jamieh
30251662Sdim * @library  ../lib/
31251662Sdim * @build    JavadocTester TestHelpOption
32251662Sdim * @run main TestHelpOption
33251662Sdim */
34249423Sdim
35251662Sdimpublic class TestHelpOption extends JavadocTester {
36249423Sdim
37251662Sdim    //Test information.
38249423Sdim    private static final String BUG_ID = "4934778-4777599-6553182";
39239310Sdim
40251662Sdim    //Javadoc arguments.
41251662Sdim    private static final String[] ARGS = new String[] {
42251662Sdim        "-d", BUG_ID, "-sourcepath", SRC_DIR, "-help",
43251662Sdim            SRC_DIR + "/TestHelpOption.java"
44251662Sdim    };
45251662Sdim
46251662Sdim    private static final String[] ARGS2 = new String[] {
47239310Sdim        "-d", BUG_ID, "-sourcepath", SRC_DIR,
48251662Sdim            SRC_DIR + "/TestHelpOption.java"
49251662Sdim    };
50239310Sdim
51239310Sdim    private static final String[][] TEST = {
52239310Sdim        {STANDARD_OUTPUT, "-d "},
53239310Sdim        {STANDARD_OUTPUT, "-use "},
54239310Sdim        {STANDARD_OUTPUT, "-version "},
55239310Sdim        {STANDARD_OUTPUT, "-author "},
56239310Sdim        {STANDARD_OUTPUT, "-docfilessubdirs "},
57239310Sdim        {STANDARD_OUTPUT, "-splitindex "},
58239310Sdim        {STANDARD_OUTPUT, "-windowtitle "},
59239310Sdim        {STANDARD_OUTPUT, "-doctitle "},
60239310Sdim        {STANDARD_OUTPUT, "-header "},
61239310Sdim        {STANDARD_OUTPUT, "-footer "},
62251662Sdim        {STANDARD_OUTPUT, "-bottom "},
63251662Sdim        {STANDARD_OUTPUT, "-link "},
64251662Sdim        {STANDARD_OUTPUT, "-linkoffline "},
65251662Sdim        {STANDARD_OUTPUT, "-excludedocfilessubdir "},
66251662Sdim        {STANDARD_OUTPUT, "-group "},
67239310Sdim        {STANDARD_OUTPUT, "-nocomment "},
68239310Sdim        {STANDARD_OUTPUT, "-nodeprecated "},
69239310Sdim        {STANDARD_OUTPUT, "-noqualifier "},
70239310Sdim        {STANDARD_OUTPUT, "-nosince "},
71239310Sdim        {STANDARD_OUTPUT, "-notimestamp "},
72239310Sdim        {STANDARD_OUTPUT, "-nodeprecatedlist "},
73239310Sdim        {STANDARD_OUTPUT, "-notree "},
74239310Sdim        {STANDARD_OUTPUT, "-noindex "},
75251662Sdim        {STANDARD_OUTPUT, "-nohelp "},
76251662Sdim        {STANDARD_OUTPUT, "-nonavbar "},
77251662Sdim        {STANDARD_OUTPUT, "-serialwarn "},
78239310Sdim        {STANDARD_OUTPUT, "-tag "},
79239310Sdim        {STANDARD_OUTPUT, "-taglet "},
80251662Sdim        {STANDARD_OUTPUT, "-tagletpath "},
81239310Sdim        {STANDARD_OUTPUT, "-charset "},
82239310Sdim        {STANDARD_OUTPUT, "-helpfile "},
83239310Sdim        {STANDARD_OUTPUT, "-linksource "},
84239310Sdim        {STANDARD_OUTPUT, "-sourcetab "},
85239310Sdim        {STANDARD_OUTPUT, "-keywords "},
86239310Sdim        {STANDARD_OUTPUT, "-stylesheetfile "},
87239310Sdim        {STANDARD_OUTPUT, "-docencoding "},
88239310Sdim    };
89239310Sdim    private static final String[][] NEGATED_TEST = NO_TEST;
90239310Sdim
91251662Sdim    private static final String[][] TEST2 = {
92251662Sdim        {BUG_ID + "/TestHelpOption.html",
93239310Sdim            "<li><a href=\"help-doc.html\">Help</a></li>"
94239310Sdim        },
95239310Sdim    };
96239310Sdim    private static final String[][] NEGATED_TEST2 = NO_TEST;
97239310Sdim
98239310Sdim    //The help option should not crash the doclet.
99239310Sdim    private static final int EXPECTED_EXIT_CODE = 0;
100251662Sdim
101251662Sdim    /**
102251662Sdim     * The entry point of the test.
103251662Sdim     * @param args the array of command line arguments.
104251662Sdim     */
105251662Sdim    public static void main(String[] args) {
106251662Sdim        TestHelpOption tester = new TestHelpOption();
107239310Sdim        int actualExitCode = tester.run(ARGS, TEST, NEGATED_TEST);
108239310Sdim        tester.checkExitCode(EXPECTED_EXIT_CODE, actualExitCode);
109239310Sdim        tester.run(ARGS2, TEST2, NEGATED_TEST2);
110239310Sdim        tester.printSummary();
111239310Sdim    }
112239310Sdim
113239310Sdim    /**
114239310Sdim     * {@inheritDoc}
115239310Sdim     */
116239310Sdim    public String getBugId() {
117239310Sdim        return BUG_ID;
118239310Sdim    }
119239310Sdim
120239310Sdim    /**
121239310Sdim     * {@inheritDoc}
122239310Sdim     */
123239310Sdim    public String getBugName() {
124239310Sdim        return getClass().getName();
125239310Sdim    }
126239310Sdim}
127239310Sdim