TestXOption.java revision 2381:7ce35e0917e2
1249259Sdim/*
2249259Sdim * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
3249259Sdim * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4249259Sdim *
5249259Sdim * This code is free software; you can redistribute it and/or modify it
6249259Sdim * under the terms of the GNU General Public License version 2 only, as
7249259Sdim * published by the Free Software Foundation.
8249259Sdim *
9249259Sdim * This code is distributed in the hope that it will be useful, but WITHOUT
10249259Sdim * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11249259Sdim * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12249259Sdim * version 2 for more details (a copy is included in the LICENSE file that
13249259Sdim * accompanied this code).
14249259Sdim *
15249259Sdim * You should have received a copy of the GNU General Public License version
16249259Sdim * 2 along with this work; if not, write to the Free Software Foundation,
17249259Sdim * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18249259Sdim *
19249259Sdim * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20249259Sdim * or visit www.oracle.com if you need additional information or have any
21249259Sdim * questions.
22249259Sdim */
23249259Sdim
24249259Sdim/*
25249259Sdim * @test
26249259Sdim * @bug      8007687
27249259Sdim * @summary  Make sure that the -X option works properly.
28249259Sdim * @library  ../lib/
29249259Sdim * @build    JavadocTester TestXOption
30249259Sdim * @run main TestXOption
31249259Sdim */
32249259Sdim
33249259Sdimpublic class TestXOption extends JavadocTester {
34251662Sdim
35263508Sdim    //Test information.
36263508Sdim    private static final String BUG_ID = "8007687";
37263508Sdim
38263508Sdim    //Javadoc arguments.
39263508Sdim    private static final String[] ARGS = new String[] {
40263508Sdim        "-d", BUG_ID, "-sourcepath", SRC_DIR, "-X",
41249259Sdim            SRC_DIR + "/TestXOption.java"
42249259Sdim    };
43249259Sdim
44249259Sdim    private static final String[] ARGS2 = new String[] {
45249259Sdim        "-d", BUG_ID, "-sourcepath", SRC_DIR,
46249259Sdim            SRC_DIR + "/TestXOption.java"
47249259Sdim    };
48249259Sdim
49249259Sdim    private static final String[][] TEST = {
50251662Sdim        {NOTICE_OUTPUT, "-Xmaxerrs "},
51251662Sdim        {NOTICE_OUTPUT, "-Xmaxwarns "},
52251662Sdim        {STANDARD_OUTPUT, "-Xdocrootparent "},
53263508Sdim        {STANDARD_OUTPUT, "-Xdoclint "},
54263508Sdim        {STANDARD_OUTPUT, "-Xdoclint:"},
55263508Sdim    };
56263508Sdim
57263508Sdim    //The help option should not crash the doclet.
58263508Sdim    private static final int EXPECTED_EXIT_CODE = 0;
59263508Sdim
60263508Sdim    /**
61251662Sdim     * The entry point of the test.
62263508Sdim     * @param args the array of command line arguments.
63263508Sdim     */
64263508Sdim    public static void main(String[] args) {
65263508Sdim        TestXOption tester = new TestXOption();
66263508Sdim        int actualExitCode = tester.run(ARGS, TEST, NO_TEST);
67263508Sdim        tester.checkExitCode(EXPECTED_EXIT_CODE, actualExitCode);
68263508Sdim        tester.printSummary();
69263508Sdim    }
70263508Sdim
71263508Sdim    /**
72263508Sdim     * {@inheritDoc}
73263508Sdim     */
74263508Sdim    public String getBugId() {
75263508Sdim        return BUG_ID;
76263508Sdim    }
77263508Sdim
78249259Sdim    /**
79249259Sdim     * {@inheritDoc}
80249259Sdim     */
81249259Sdim    public String getBugName() {
82249259Sdim        return getClass().getName();
83249259Sdim    }
84249259Sdim}
85249259Sdim