langtools/test/jdk/javadoc/doclet/testPackageHtml/TestPackageHtml.java
changeset 45860 0952e2c6545a
parent 41451 a847c7aa25a7
equal deleted inserted replaced
45761:9ef5029b247b 45860:0952e2c6545a
     1 /*
     1 /*
     2  * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     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
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    21  * questions.
    21  * questions.
    22  */
    22  */
    23 
    23 
    24 /*
    24 /*
    25  * @test
    25  * @test
    26  * @bug      8150096
    26  * @bug      8150096 8179704
    27  * @summary  Make sure package.html is recognized by doclint
    27  * @summary  test package.html handling
    28  * @library  ../lib
    28  * @library  ../lib
    29  * @modules jdk.javadoc/jdk.javadoc.internal.tool
    29  * @modules jdk.javadoc/jdk.javadoc.internal.tool
    30  * @build    JavadocTester
    30  * @build    JavadocTester
    31  * @run main TestPackageHtml
    31  * @run main TestPackageHtml
    32  */
    32  */
    35     public static void main(String... args) throws Exception  {
    35     public static void main(String... args) throws Exception  {
    36         TestPackageHtml tester = new TestPackageHtml();
    36         TestPackageHtml tester = new TestPackageHtml();
    37         tester.runTests();
    37         tester.runTests();
    38     }
    38     }
    39 
    39 
       
    40     // Make sure package.html is recognized by doclint
    40     @Test
    41     @Test
    41     void testPackageHtml() {
    42     void testPackageHtml() {
    42         javadoc("-d", "out-pkg-html",
    43         javadoc("-d", "out-pkg-html-1",
    43                 "-sourcepath", testSrc,
    44                 "-sourcepath", testSrc,
    44                 "pkg1");
    45                 "pkg1");
    45         checkExit(Exit.ERROR);
    46         checkExit(Exit.ERROR);
    46         checkOutput(Output.OUT, true, "package.html:10: error: bad use of '>'");
    47         checkOutput(Output.OUT, true, "package.html:10: error: bad use of '>'");
    47     }
    48     }
       
    49 
       
    50     // Doclet must handle empty body in package.html, must
       
    51     // ignore html comment in the first sentence and must
       
    52     // ignore trailing whitespace in a first sentence.
       
    53     @Test
       
    54     void testPackageHtmlWithEmptyBody() {
       
    55         javadoc("-d", "out-pkg-html-2",
       
    56                 "-sourcepath", testSrc,
       
    57                 "pkg2", "pkg3", "pkg4");
       
    58         checkExit(Exit.OK);
       
    59         checkOutput("index-all.html", true,
       
    60               "<dl>\n"
       
    61                       + "<dt><a href=\"pkg2/package-summary.html\">pkg2</a> - package pkg2</dt>\n"
       
    62                       + "<dt><a href=\"pkg3/package-summary.html\">pkg3</a> - package pkg3</dt>\n"
       
    63                       + "<dd>\n"
       
    64                       + "<div class=\"block\">This is a documentation for <a href=\"pkg3/package-summary.html\"><code>pkg3</code></a></div>\n"
       
    65                       + "</dd>\n"
       
    66                       + "<dt><a href=\"pkg4/package-summary.html\">pkg4</a> - package pkg4</dt>\n"
       
    67                       + "<dd>\n"
       
    68                       + "<div class=\"block\">This is a documentation for <a href=\"pkg4/package-summary.html\"><code>pkg4</code></a></div>\n"
       
    69                       + "</dd>\n"
       
    70                       + "</dl>\n");
       
    71     }
    48 }
    72 }