langtools/test/jdk/javadoc/doclet/testSearch/TestSearch.java
changeset 36705 890c250d8da8
parent 35426 374342e56a56
child 36709 f9f252088afa
equal deleted inserted replaced
36503:4a95f4b1bd8b 36705:890c250d8da8
     1 /*
     1 /*
     2  * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2015, 2016, 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 8141492
    26  * @bug 8141492 8071982
    27  * @summary Test the search feature of javadoc.
    27  * @summary Test the search feature of javadoc.
    28  * @author bpatel
    28  * @author bpatel
    29  * @library ../lib
    29  * @library ../lib
    30  * @modules jdk.javadoc
    30  * @modules jdk.javadoc
    31  * @build JavadocTester
    31  * @build JavadocTester
   232     void checkSingleIndex(boolean expectedOutput) {
   232     void checkSingleIndex(boolean expectedOutput) {
   233         // Test for search tags markup in index file.
   233         // Test for search tags markup in index file.
   234         checkOutput("index-all.html", expectedOutput,
   234         checkOutput("index-all.html", expectedOutput,
   235                 "<dt><span class=\"searchTagLink\"><a href=\"pkg/package-summary.html#phrasewithspaces\">"
   235                 "<dt><span class=\"searchTagLink\"><a href=\"pkg/package-summary.html#phrasewithspaces\">"
   236                         + "phrase with spaces</a></span> - Search tag in pkg</dt>",
   236                         + "phrase with spaces</a></span> - Search tag in pkg</dt>",
       
   237                 "<dt><span class=\"searchTagLink\"><a href=\"pkg/package-summary.html#pkg\">"
       
   238                         + "pkg</a></span> - Search tag in pkg</dt>",
       
   239                 "<dt><span class=\"searchTagLink\"><a href=\"pkg/package-summary.html#pkg2.5\">"
       
   240                         + "pkg2.5</a></span> - Search tag in pkg</dt>",
       
   241                 "<dt><span class=\"searchTagLink\"><a href=\"pkg/package-summary.html#r\">"
       
   242                         + "r</a></span> - Search tag in pkg</dt>",
   237                 "<dt><span class=\"searchTagLink\"><a href=\"pkg1/RegClass.html#searchphrase\">"
   243                 "<dt><span class=\"searchTagLink\"><a href=\"pkg1/RegClass.html#searchphrase\">"
   238                         + "search phrase</a></span> - Search tag in pkg1.RegClass</dt>",
   244                         + "search phrase</a></span> - Search tag in pkg1.RegClass</dt>",
   239                 "<dt><span class=\"searchTagLink\"><a href=\"pkg1/RegClass.html#SearchWordWithDescription\">"
   245                 "<dt><span class=\"searchTagLink\"><a href=\"pkg1/RegClass.html#SearchWordWithDescription\">"
   240                         + "SearchWordWithDescription</a></span> - Search tag in pkg1.RegClass.CONSTANT_FIELD_1</dt>",
   246                         + "SearchWordWithDescription</a></span> - Search tag in pkg1.RegClass.CONSTANT_FIELD_1</dt>",
   241                 "<dt><span class=\"searchTagLink\"><a href=\"pkg2/TestAnnotationType.html#searchphrasewithdescdeprecated\">"
   247                 "<dt><span class=\"searchTagLink\"><a href=\"pkg2/TestAnnotationType.html#searchphrasewithdescdeprecated\">"
   288                         + "SearchTagDeprecatedMethod</a></span> - Search tag in pkg2.TestError</dt>",
   294                         + "SearchTagDeprecatedMethod</a></span> - Search tag in pkg2.TestError</dt>",
   289                 "<dt><span class=\"searchTagLink\"><a href=\"../pkg/package-summary.html#SingleWord\">"
   295                 "<dt><span class=\"searchTagLink\"><a href=\"../pkg/package-summary.html#SingleWord\">"
   290                         + "SingleWord</a></span> - Search tag in pkg</dt>");
   296                         + "SingleWord</a></span> - Search tag in pkg</dt>");
   291         checkOutput("index-files/index-9.html", true,
   297         checkOutput("index-files/index-9.html", true,
   292                 "<dt><span class=\"searchTagLink\"><a href=\"../pkg/package-summary.html#phrasewithspaces\">"
   298                 "<dt><span class=\"searchTagLink\"><a href=\"../pkg/package-summary.html#phrasewithspaces\">"
   293                         + "phrase with spaces</a></span> - Search tag in pkg</dt>");
   299                         + "phrase with spaces</a></span> - Search tag in pkg</dt>",
       
   300                 "<dt><span class=\"searchTagLink\"><a href=\"../pkg/package-summary.html#pkg\">"
       
   301                         + "pkg</a></span> - Search tag in pkg</dt>",
       
   302                 "<dt><span class=\"searchTagLink\"><a href=\"../pkg/package-summary.html#pkg2.5\">"
       
   303                         + "pkg2.5</a></span> - Search tag in pkg</dt>");
       
   304         checkOutput("index-files/index-11.html", true,
       
   305                 "<dt><span class=\"searchTagLink\"><a href=\"../pkg/package-summary.html#r\">"
       
   306                         + "r</a></span> - Search tag in pkg</dt>");
   294         checkOutput("index-files/index-8.html", true,
   307         checkOutput("index-files/index-8.html", true,
   295                 "<dt><span class=\"searchTagLink\"><a href=\"../pkg/AnotherClass.ModalExclusionType.html"
   308                 "<dt><span class=\"searchTagLink\"><a href=\"../pkg/AnotherClass.ModalExclusionType.html"
   296                         + "#nested%7B@indexnested_tag_test%7D\">nested {@index nested_tag_test}</a></span> - "
   309                         + "#nested%7B@indexnested_tag_test%7D\">nested {@index nested_tag_test}</a></span> - "
   297                         + "Search tag in pkg.AnotherClass.ModalExclusionType.NO_EXCLUDE</dt>");
   310                         + "Search tag in pkg.AnotherClass.ModalExclusionType.NO_EXCLUDE</dt>");
   298         checkOutput("index-files/index-5.html", true,
   311         checkOutput("index-files/index-5.html", true,
   307     void checkIndexNoComment() {
   320     void checkIndexNoComment() {
   308         // Test for search tags markup in index file when javadoc is executed with -nocomment.
   321         // Test for search tags markup in index file when javadoc is executed with -nocomment.
   309         checkOutput("index-all.html", false,
   322         checkOutput("index-all.html", false,
   310                 "<dt><span class=\"searchTagLink\"><a href=\"pkg/package-summary.html#phrasewithspaces\">"
   323                 "<dt><span class=\"searchTagLink\"><a href=\"pkg/package-summary.html#phrasewithspaces\">"
   311                         + "phrase with spaces</a></span> - Search tag in pkg</dt>",
   324                         + "phrase with spaces</a></span> - Search tag in pkg</dt>",
       
   325                 "<dt><span class=\"searchTagLink\"><a href=\"pkg/package-summary.html#pkg\">"
       
   326                         + "pkg</a></span> - Search tag in pkg</dt>",
       
   327                 "<dt><span class=\"searchTagLink\"><a href=\"pkg/package-summary.html#pkg2.5\">"
       
   328                         + "pkg2.5</a></span> - Search tag in pkg</dt>",
       
   329                 "<dt><span class=\"searchTagLink\"><a href=\"pkg/package-summary.html#r\">"
       
   330                         + "r</a></span> - Search tag in pkg</dt>",
   312                 "<dt><span class=\"searchTagLink\"><a href=\"pkg1/RegClass.html#searchphrase\">"
   331                 "<dt><span class=\"searchTagLink\"><a href=\"pkg1/RegClass.html#searchphrase\">"
   313                         + "search phrase</a></span> - Search tag in pkg1.RegClass</dt>",
   332                         + "search phrase</a></span> - Search tag in pkg1.RegClass</dt>",
   314                 "<dt><span class=\"searchTagLink\"><a href=\"pkg1/RegClass.html#SearchWordWithDescription\">"
   333                 "<dt><span class=\"searchTagLink\"><a href=\"pkg1/RegClass.html#SearchWordWithDescription\">"
   315                         + "SearchWordWithDescription</a></span> - Search tag in pkg1.RegClass.CONSTANT_FIELD_1</dt>",
   334                         + "SearchWordWithDescription</a></span> - Search tag in pkg1.RegClass.CONSTANT_FIELD_1</dt>",
   316                 "<dt><span class=\"searchTagLink\"><a href=\"pkg2/TestAnnotationType.html#searchphrasewithdescdeprecated\">"
   335                 "<dt><span class=\"searchTagLink\"><a href=\"pkg2/TestAnnotationType.html#searchphrasewithdescdeprecated\">"