langtools/test/jdk/javadoc/doclet/testHelpOption/TestHelpOption.java
author ksrini
Mon, 14 Mar 2016 15:04:57 -0700
changeset 36705 890c250d8da8
parent 35426 374342e56a56
child 36709 f9f252088afa
permissions -rw-r--r--
8071982: Update tests for revamped Doclet API 8071984: Update test cases for repeating and type annotations output in javadoc Reviewed-by: ksrini, bpatel Contributed-by: oleg.barbashov@oracle.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
     2
 * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
06bc494ca11e Initial load
duke
parents:
diff changeset
     4
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
06bc494ca11e Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
06bc494ca11e Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
06bc494ca11e Initial load
duke
parents:
diff changeset
     8
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
06bc494ca11e Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
06bc494ca11e Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
06bc494ca11e Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
06bc494ca11e Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
06bc494ca11e Initial load
duke
parents:
diff changeset
    14
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
06bc494ca11e Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
06bc494ca11e Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
06bc494ca11e Initial load
duke
parents:
diff changeset
    18
 *
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 1787
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 1787
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 1787
diff changeset
    21
 * questions.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    22
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    23
06bc494ca11e Initial load
duke
parents:
diff changeset
    24
/*
06bc494ca11e Initial load
duke
parents:
diff changeset
    25
 * @test
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
    26
 * @bug      4934778 4777599 6553182 8146427 8146475
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
    27
 * @summary  Make sure that -help, -helpfile and -nohelp options work correctly.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    28
 * @author   jamieh
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    29
 * @library ../lib
30730
d3ce7619db2c 8076543: Add @modules as needed to the langtools tests
akulyakh
parents: 24399
diff changeset
    30
 * @modules jdk.javadoc
9608
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 7681
diff changeset
    31
 * @build    JavadocTester TestHelpOption
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    32
 * @run main TestHelpOption
06bc494ca11e Initial load
duke
parents:
diff changeset
    33
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    34
06bc494ca11e Initial load
duke
parents:
diff changeset
    35
public class TestHelpOption extends JavadocTester {
06bc494ca11e Initial load
duke
parents:
diff changeset
    36
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    37
    public static void main(String... args) throws Exception {
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    38
        TestHelpOption tester = new TestHelpOption();
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    39
        tester.runTests();
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    40
    }
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    41
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    42
    @Test
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    43
    void testWithOption() {
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    44
        javadoc("-d", "out1",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    45
                "-sourcepath", testSrc,
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    46
                "-help",
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
    47
                testSrc("Sample.java"));
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    48
        checkExit(Exit.OK);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    49
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    50
        checkOutput(true);
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    51
    }
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    52
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    53
    @Test
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    54
    void testWithoutOption() {
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    55
        javadoc("-d", "out2",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    56
                "-sourcepath", testSrc,
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
    57
                testSrc("Sample.java"));
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
    58
        checkExit(Exit.OK);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
    59
    }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
    60
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
    61
    @Test
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
    62
    void testNohelpOption() {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
    63
        javadoc("-d", "out3",
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
    64
                "-sourcepath", testSrc,
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
    65
                "-nohelp",
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
    66
                testSrc("Sample.java"));
36705
890c250d8da8 8071982: Update tests for revamped Doclet API
ksrini
parents: 35426
diff changeset
    67
        checkOutput("Sample.html", false, "<li><a href=\"../help-doc.html\">Help</a></li>");
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
    68
        checkExit(Exit.OK);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
    69
    }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
    70
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
    71
    @Test
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
    72
    void testHelpfileOption() {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
    73
        javadoc("-d", "out4",
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
    74
                "-sourcepath", testSrc,
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
    75
                "-helpfile", testSrc("test-help.html"),
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
    76
                testSrc("Sample.java"));
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    77
        checkExit(Exit.OK);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
    78
        checkOutput("Sample.html", true,
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
    79
                "<li><a href=\"test-help.html\">Help</a></li>");
36705
890c250d8da8 8071982: Update tests for revamped Doclet API
ksrini
parents: 35426
diff changeset
    80
        checkOutput("test-help.html", true,
890c250d8da8 8071982: Update tests for revamped Doclet API
ksrini
parents: 35426
diff changeset
    81
                "Help, help.");
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
    82
    }
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
    83
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
    84
    @Test
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
    85
    void testHelpfileReuseOption() {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
    86
        javadoc("-d", "out5",
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
    87
                "-sourcepath", testSrc,
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
    88
                "-helpfile", testSrc("test-help.html"),
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
    89
                "-helpfile", testSrc("test-help.html"),
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
    90
                testSrc("Sample.java"));
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
    91
        checkExit(Exit.FAILED);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
    92
    }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
    93
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
    94
    @Test
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
    95
    void testHelpfileNohelpConflict() {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
    96
        javadoc("-d", "out6",
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
    97
                "-sourcepath", testSrc,
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
    98
                "-helpfile", testSrc("test-help.html"),
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
    99
                "-nohelp",
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
   100
                testSrc("Sample.java"));
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
   101
        checkExit(Exit.FAILED);
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   102
    }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   103
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   104
    private void checkOutput(boolean withOption) {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
   105
        checkOutput(Output.OUT, withOption,
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   106
                "-d ",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   107
                "-use ",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   108
                "-version ",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   109
                "-author ",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   110
                "-docfilessubdirs ",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   111
                "-splitindex ",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   112
                "-windowtitle ",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   113
                "-doctitle ",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   114
                "-header ",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   115
                "-footer ",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   116
                "-bottom ",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   117
                "-link ",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   118
                "-linkoffline ",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   119
                "-excludedocfilessubdir ",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   120
                "-group ",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   121
                "-nocomment ",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   122
                "-nodeprecated ",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   123
                "-noqualifier ",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   124
                "-nosince ",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   125
                "-notimestamp ",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   126
                "-nodeprecatedlist ",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   127
                "-notree ",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   128
                "-noindex ",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   129
                "-nohelp ",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   130
                "-nonavbar ",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   131
                "-serialwarn ",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   132
                "-tag ",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   133
                "-taglet ",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   134
                "-tagletpath ",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   135
                "-charset ",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   136
                "-helpfile ",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   137
                "-linksource ",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   138
                "-sourcetab ",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   139
                "-keywords ",
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   140
                "-stylesheetfile ",
36705
890c250d8da8 8071982: Update tests for revamped Doclet API
ksrini
parents: 35426
diff changeset
   141
                "-docencoding ",
890c250d8da8 8071982: Update tests for revamped Doclet API
ksrini
parents: 35426
diff changeset
   142
                "-html4 ",
890c250d8da8 8071982: Update tests for revamped Doclet API
ksrini
parents: 35426
diff changeset
   143
                "-html5 ",
890c250d8da8 8071982: Update tests for revamped Doclet API
ksrini
parents: 35426
diff changeset
   144
                "-top ",
890c250d8da8 8071982: Update tests for revamped Doclet API
ksrini
parents: 35426
diff changeset
   145
                "-author ",
890c250d8da8 8071982: Update tests for revamped Doclet API
ksrini
parents: 35426
diff changeset
   146
                "-noqualifier ",
890c250d8da8 8071982: Update tests for revamped Doclet API
ksrini
parents: 35426
diff changeset
   147
                "-nosince ",
890c250d8da8 8071982: Update tests for revamped Doclet API
ksrini
parents: 35426
diff changeset
   148
                "-notimestamp ",
890c250d8da8 8071982: Update tests for revamped Doclet API
ksrini
parents: 35426
diff changeset
   149
                "-sourcetab ");
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   150
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 30730
diff changeset
   151
        checkOutput("Sample.html", !withOption,
24399
af1a0220d0fa 8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents: 24072
diff changeset
   152
                "<li><a href=\"help-doc.html\">Help</a></li>");
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   153
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   154
}