test/langtools/jdk/javadoc/doclet/testSummaryTag/TestSummaryTag.java
author jjg
Mon, 04 Mar 2019 11:19:34 -0800
changeset 53991 786825220790
parent 53883 f41793b5b83f
child 54350 4f9772f4403d
permissions -rw-r--r--
8219801: Pages do not have <h1> Reviewed-by: hannesw
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
46184
f1325703ea85 8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
diff changeset
     1
/*
53562
0d9dee001667 8215577: Remove javadoc support for HTML 4
pmuthuswamy
parents: 53097
diff changeset
     2
 * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
46184
f1325703ea85 8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
f1325703ea85 8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
diff changeset
     4
 *
f1325703ea85 8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
f1325703ea85 8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
52377
907fdbbdf584 8213263: fix legal headers in test/langtools
jjg
parents: 51127
diff changeset
     7
 * published by the Free Software Foundation.
46184
f1325703ea85 8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
diff changeset
     8
 *
f1325703ea85 8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
f1325703ea85 8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
f1325703ea85 8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
f1325703ea85 8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
f1325703ea85 8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
diff changeset
    13
 * accompanied this code).
f1325703ea85 8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
diff changeset
    14
 *
f1325703ea85 8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
f1325703ea85 8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
f1325703ea85 8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
f1325703ea85 8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
diff changeset
    18
 *
f1325703ea85 8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f1325703ea85 8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f1325703ea85 8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
diff changeset
    21
 * questions.
f1325703ea85 8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
diff changeset
    22
 */
f1325703ea85 8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
diff changeset
    23
f1325703ea85 8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
diff changeset
    24
/*
f1325703ea85 8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
diff changeset
    25
 * @test
50293
edfb87b2520e 8196202: Javadoc should not generate frames by default
jjg
parents: 49139
diff changeset
    26
 * @bug      8173425 8186332 8182765 8196202
46184
f1325703ea85 8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
diff changeset
    27
 * @summary  tests for the summary tag behavior
53097
2e82ca64b25d 8215516: Move JavadocTester to a named package
jjg
parents: 52377
diff changeset
    28
 * @library  ../../lib
46184
f1325703ea85 8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
diff changeset
    29
 * @modules jdk.javadoc/jdk.javadoc.internal.tool
53097
2e82ca64b25d 8215516: Move JavadocTester to a named package
jjg
parents: 52377
diff changeset
    30
 * @build    javadoc.tester.*
46184
f1325703ea85 8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
diff changeset
    31
 * @run main TestSummaryTag
f1325703ea85 8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
diff changeset
    32
 */
f1325703ea85 8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
diff changeset
    33
53097
2e82ca64b25d 8215516: Move JavadocTester to a named package
jjg
parents: 52377
diff changeset
    34
import javadoc.tester.JavadocTester;
2e82ca64b25d 8215516: Move JavadocTester to a named package
jjg
parents: 52377
diff changeset
    35
46184
f1325703ea85 8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
diff changeset
    36
public class TestSummaryTag extends JavadocTester {
f1325703ea85 8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
diff changeset
    37
f1325703ea85 8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
diff changeset
    38
    public static void main(String... args) throws Exception {
f1325703ea85 8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
diff changeset
    39
        TestSummaryTag tester = new TestSummaryTag();
f1325703ea85 8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
diff changeset
    40
        tester.runTests();
f1325703ea85 8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
diff changeset
    41
    }
f1325703ea85 8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
diff changeset
    42
f1325703ea85 8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
diff changeset
    43
    @Test
53097
2e82ca64b25d 8215516: Move JavadocTester to a named package
jjg
parents: 52377
diff changeset
    44
    public void test1() {
46184
f1325703ea85 8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
diff changeset
    45
        javadoc("-d", "out1",
f1325703ea85 8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
diff changeset
    46
                "-sourcepath", testSrc,
f1325703ea85 8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
diff changeset
    47
                "p1");
f1325703ea85 8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
diff changeset
    48
        checkExit(Exit.OK);
f1325703ea85 8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
diff changeset
    49
f1325703ea85 8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
diff changeset
    50
        checkOutput("index-all.html", true,
f1325703ea85 8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
diff changeset
    51
            "<dl>\n"
49139
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48028
diff changeset
    52
            + "<dt><span class=\"memberNameLink\"><a href=\"p1/A.html#m()\">m()"
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48028
diff changeset
    53
            + "</a></span> - Method in class p1.<a href=\"p1/A.html\" title=\"class in p1\">A</a></dt>\n"
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48028
diff changeset
    54
            + "<dd>\n"
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48028
diff changeset
    55
            + "<div class=\"block\">First sentence</div>\n"
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48028
diff changeset
    56
            + "</dd>\n"
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48028
diff changeset
    57
            + "<dt><span class=\"memberNameLink\"><a href=\"p1/B.html#m()\">m()"
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48028
diff changeset
    58
            + "</a></span> - Method in class p1.<a href=\"p1/B.html\" title=\"class in p1\">B</a></dt>\n"
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48028
diff changeset
    59
            + "<dd>\n"
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48028
diff changeset
    60
            + "<div class=\"block\">First sentence</div>\n"
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48028
diff changeset
    61
            + "</dd>\n"
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48028
diff changeset
    62
            + "<dt><span class=\"memberNameLink\"><a href=\"p1/A.html#m1()\">m1()"
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48028
diff changeset
    63
            + "</a></span> - Method in class p1.<a href=\"p1/A.html\" title=\"class in p1\">A</a></dt>\n"
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48028
diff changeset
    64
            + "<dd>\n"
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48028
diff changeset
    65
            + "<div class=\"block\"> First sentence </div>\n"
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48028
diff changeset
    66
            + "</dd>\n"
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48028
diff changeset
    67
            + "<dt><span class=\"memberNameLink\"><a href=\"p1/A.html#m2()\">m2()"
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48028
diff changeset
    68
            + "</a></span> - Method in class p1.<a href=\"p1/A.html\" title=\"class in p1\">A</a></dt>\n"
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48028
diff changeset
    69
            + "<dd>\n"
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48028
diff changeset
    70
            + "<div class=\"block\">Some html &lt;foo&gt; &nbsp; codes</div>\n"
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48028
diff changeset
    71
            + "</dd>\n"
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48028
diff changeset
    72
            + "<dt><span class=\"memberNameLink\"><a href=\"p1/A.html#m3()\">m3()"
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48028
diff changeset
    73
            + "</a></span> - Method in class p1.<a href=\"p1/A.html\" title=\"class in p1\">A</a></dt>\n"
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48028
diff changeset
    74
            + "<dd>\n"
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48028
diff changeset
    75
            + "<div class=\"block\">First sentence </div>\n"
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48028
diff changeset
    76
            + "</dd>\n"
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48028
diff changeset
    77
            + "<dt><span class=\"memberNameLink\"><a href=\"p1/A.html#m4()\">m4()"
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48028
diff changeset
    78
            + "</a></span> - Method in class p1.<a href=\"p1/A.html\" title=\"class in p1\">A</a></dt>\n"
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48028
diff changeset
    79
            + "<dd>\n"
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48028
diff changeset
    80
            + "<div class=\"block\">First sentence i.e. the first sentence</div>\n"
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48028
diff changeset
    81
            + "</dd>\n"
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48028
diff changeset
    82
            + "</dl>\n",
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48028
diff changeset
    83
            "<div class=\"block\">The first... line</div>\n"
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48028
diff changeset
    84
        );
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48028
diff changeset
    85
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48028
diff changeset
    86
        // make sure the second @summary's content is displayed correctly
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48028
diff changeset
    87
        checkOutput("p1/A.html", true,
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48028
diff changeset
    88
             "<li class=\"blockList\">\n"
53991
786825220790 8219801: Pages do not have <h1>
jjg
parents: 53883
diff changeset
    89
             + "<h3>m3</h3>\n"
51127
c2e676c2cf7b 8207190: JDK 11 javadoc generates bad code example
pmuthuswamy
parents: 50293
diff changeset
    90
             + "<pre class=\"methodSignature\">public&nbsp;void&nbsp;m3()</pre>\n"
49139
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48028
diff changeset
    91
             + "<div class=\"block\">First sentence  some text maybe second sentence.</div>\n"
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48028
diff changeset
    92
             + "</li>\n"
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48028
diff changeset
    93
        );
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48028
diff changeset
    94
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48028
diff changeset
    95
        checkOutput("p1/package-summary.html", true,
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48028
diff changeset
    96
                "<div class=\"block\">The first... line second from ...</div>");
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48028
diff changeset
    97
    }
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48028
diff changeset
    98
771616d26ca1 8182765: HTML5 must be the default javadoc codegen mode in the near future
bpatel
parents: 48028
diff changeset
    99
    @Test
53097
2e82ca64b25d 8215516: Move JavadocTester to a named package
jjg
parents: 52377
diff changeset
   100
    public void test2() {
46184
f1325703ea85 8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
diff changeset
   101
        javadoc("-d", "out2",
f1325703ea85 8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
diff changeset
   102
                "-sourcepath", testSrc,
f1325703ea85 8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
diff changeset
   103
                "p2");
f1325703ea85 8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
diff changeset
   104
        checkExit(Exit.OK);
f1325703ea85 8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
diff changeset
   105
48028
9e022f580a9d 8190552: Augment the Compiler API tree with APIs to represent HTML content
ksrini
parents: 47284
diff changeset
   106
        checkOutput(Output.OUT, true, "package.html:3: warning: invalid use of @summary");
46184
f1325703ea85 8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
diff changeset
   107
f1325703ea85 8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
diff changeset
   108
        checkOutput("index-all.html", true, "<div class=\"block\">foo bar</div>\n");
f1325703ea85 8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
diff changeset
   109
f1325703ea85 8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
diff changeset
   110
        checkOutput("p2/package-summary.html", true, "<div class=\"block\">foo bar baz.</div>\n");
f1325703ea85 8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
diff changeset
   111
    }
f1325703ea85 8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
diff changeset
   112
f1325703ea85 8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
diff changeset
   113
    @Test
53097
2e82ca64b25d 8215516: Move JavadocTester to a named package
jjg
parents: 52377
diff changeset
   114
    public void test3() {
46184
f1325703ea85 8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
diff changeset
   115
        javadoc("-d", "out3",
50293
edfb87b2520e 8196202: Javadoc should not generate frames by default
jjg
parents: 49139
diff changeset
   116
                "--frames",
46184
f1325703ea85 8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
diff changeset
   117
                "-sourcepath", testSrc,
f1325703ea85 8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
diff changeset
   118
                "-overview", testSrc("p3/overview.html"),
f1325703ea85 8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
diff changeset
   119
                "p3");
f1325703ea85 8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
diff changeset
   120
        checkExit(Exit.OK);
f1325703ea85 8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
diff changeset
   121
f1325703ea85 8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
diff changeset
   122
        checkOutput("overview-summary.html", true,
f1325703ea85 8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
diff changeset
   123
                "<div class=\"block\">The first... line second from ...</div>");
f1325703ea85 8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
diff changeset
   124
    }
f1325703ea85 8173425: Javadoc needs a new tag to specify the summary.
ksrini
parents:
diff changeset
   125
}