author | jjg |
Thu, 21 Feb 2019 17:50:27 -0800 | |
changeset 53883 | f41793b5b83f |
parent 53879 | e7cb0348fa1c |
child 53991 | 786825220790 |
permissions | -rw-r--r-- |
51862 | 1 |
/* |
53883
f41793b5b83f
8219558: jdk/javadoc tests fail with missing headings: h1
jjg
parents:
53879
diff
changeset
|
2 |
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. |
51862 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
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 |
|
52377 | 7 |
* published by the Free Software Foundation. |
51862 | 8 |
* |
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
20 |
* or visit www.oracle.com if you need additional information or have any |
|
21 |
* questions. |
|
22 |
*/ |
|
23 |
||
24 |
/* |
|
25 |
* @test |
|
26 |
* @bug 8202462 |
|
27 |
* @summary {@index} may cause duplicate labels |
|
53097 | 28 |
* @library /tools/lib ../../lib |
51862 | 29 |
* @modules jdk.javadoc/jdk.javadoc.internal.tool |
53097 | 30 |
* @build javadoc.tester.* toolbox.ToolBox builder.ClassBuilder |
51862 | 31 |
* @run main TestIndexTaglet |
32 |
*/ |
|
33 |
||
34 |
||
35 |
import java.nio.file.Path; |
|
36 |
import java.nio.file.Paths; |
|
37 |
||
38 |
import builder.ClassBuilder; |
|
39 |
import builder.ClassBuilder.MethodBuilder; |
|
40 |
import toolbox.ToolBox; |
|
41 |
||
53097 | 42 |
import javadoc.tester.JavadocTester; |
43 |
||
51862 | 44 |
public class TestIndexTaglet extends JavadocTester { |
45 |
||
46 |
final ToolBox tb; |
|
47 |
||
48 |
public static void main(String... args) throws Exception { |
|
49 |
TestIndexTaglet tester = new TestIndexTaglet(); |
|
50 |
tester.runTests(m -> new Object[]{Paths.get(m.getName())}); |
|
51 |
} |
|
52 |
||
53 |
TestIndexTaglet() { |
|
54 |
tb = new ToolBox(); |
|
55 |
} |
|
56 |
||
57 |
@Test |
|
53097 | 58 |
public void test(Path base) throws Exception { |
51862 | 59 |
Path srcDir = base.resolve("src"); |
52648
12956ca371c2
8213819: doclint should warn against {@index} inside <a> tag
pmuthuswamy
parents:
52377
diff
changeset
|
60 |
Path outDir = base.resolve("out"); |
12956ca371c2
8213819: doclint should warn against {@index} inside <a> tag
pmuthuswamy
parents:
52377
diff
changeset
|
61 |
|
12956ca371c2
8213819: doclint should warn against {@index} inside <a> tag
pmuthuswamy
parents:
52377
diff
changeset
|
62 |
MethodBuilder method = MethodBuilder |
12956ca371c2
8213819: doclint should warn against {@index} inside <a> tag
pmuthuswamy
parents:
52377
diff
changeset
|
63 |
.parse("public void func(A a) {}") |
12956ca371c2
8213819: doclint should warn against {@index} inside <a> tag
pmuthuswamy
parents:
52377
diff
changeset
|
64 |
.setComments("test description with {@index search_phrase_a class a}"); |
51862 | 65 |
|
52648
12956ca371c2
8213819: doclint should warn against {@index} inside <a> tag
pmuthuswamy
parents:
52377
diff
changeset
|
66 |
new ClassBuilder(tb, "pkg.A") |
12956ca371c2
8213819: doclint should warn against {@index} inside <a> tag
pmuthuswamy
parents:
52377
diff
changeset
|
67 |
.setModifiers("public", "class") |
12956ca371c2
8213819: doclint should warn against {@index} inside <a> tag
pmuthuswamy
parents:
52377
diff
changeset
|
68 |
.addMembers(method) |
12956ca371c2
8213819: doclint should warn against {@index} inside <a> tag
pmuthuswamy
parents:
52377
diff
changeset
|
69 |
.write(srcDir); |
12956ca371c2
8213819: doclint should warn against {@index} inside <a> tag
pmuthuswamy
parents:
52377
diff
changeset
|
70 |
|
51862 | 71 |
javadoc("-d", outDir.toString(), |
72 |
"-sourcepath", srcDir.toString(), |
|
73 |
"pkg"); |
|
74 |
||
75 |
checkExit(Exit.OK); |
|
76 |
||
77 |
checkOrder("pkg/A.html", |
|
53883
f41793b5b83f
8219558: jdk/javadoc tests fail with missing headings: h1
jjg
parents:
53879
diff
changeset
|
78 |
"<h3>Method Detail</h3>\n", |
51862 | 79 |
"<div class=\"block\">test description with <a id=\"search_phrase_a\" " |
80 |
+ "class=\"searchTagResult\">search_phrase_a</a></div>"); |
|
81 |
||
82 |
checkOrder("pkg/A.html", |
|
53883
f41793b5b83f
8219558: jdk/javadoc tests fail with missing headings: h1
jjg
parents:
53879
diff
changeset
|
83 |
"<h3>Method Summary</h3>\n", |
51862 | 84 |
"<div class=\"block\">test description with search_phrase_a</div>"); |
85 |
} |
|
86 |
||
52648
12956ca371c2
8213819: doclint should warn against {@index} inside <a> tag
pmuthuswamy
parents:
52377
diff
changeset
|
87 |
@Test |
53097 | 88 |
public void testIndexWithinATag(Path base) throws Exception { |
52648
12956ca371c2
8213819: doclint should warn against {@index} inside <a> tag
pmuthuswamy
parents:
52377
diff
changeset
|
89 |
Path srcDir = base.resolve("src"); |
12956ca371c2
8213819: doclint should warn against {@index} inside <a> tag
pmuthuswamy
parents:
52377
diff
changeset
|
90 |
Path outDir = base.resolve("out"); |
51862 | 91 |
|
52648
12956ca371c2
8213819: doclint should warn against {@index} inside <a> tag
pmuthuswamy
parents:
52377
diff
changeset
|
92 |
new ClassBuilder(tb, "pkg2.A") |
51862 | 93 |
.setModifiers("public", "class") |
52648
12956ca371c2
8213819: doclint should warn against {@index} inside <a> tag
pmuthuswamy
parents:
52377
diff
changeset
|
94 |
.addMembers(MethodBuilder.parse("public void func(){}") |
12956ca371c2
8213819: doclint should warn against {@index} inside <a> tag
pmuthuswamy
parents:
52377
diff
changeset
|
95 |
.setComments("a within a : <a href='..'>{@index check}</a>")) |
51862 | 96 |
.write(srcDir); |
97 |
||
52648
12956ca371c2
8213819: doclint should warn against {@index} inside <a> tag
pmuthuswamy
parents:
52377
diff
changeset
|
98 |
javadoc("-d", outDir.toString(), |
12956ca371c2
8213819: doclint should warn against {@index} inside <a> tag
pmuthuswamy
parents:
52377
diff
changeset
|
99 |
"-sourcepath", srcDir.toString(), |
12956ca371c2
8213819: doclint should warn against {@index} inside <a> tag
pmuthuswamy
parents:
52377
diff
changeset
|
100 |
"pkg2"); |
12956ca371c2
8213819: doclint should warn against {@index} inside <a> tag
pmuthuswamy
parents:
52377
diff
changeset
|
101 |
|
12956ca371c2
8213819: doclint should warn against {@index} inside <a> tag
pmuthuswamy
parents:
52377
diff
changeset
|
102 |
checkExit(Exit.OK); |
12956ca371c2
8213819: doclint should warn against {@index} inside <a> tag
pmuthuswamy
parents:
52377
diff
changeset
|
103 |
|
12956ca371c2
8213819: doclint should warn against {@index} inside <a> tag
pmuthuswamy
parents:
52377
diff
changeset
|
104 |
checkOutput(Output.OUT, true, |
12956ca371c2
8213819: doclint should warn against {@index} inside <a> tag
pmuthuswamy
parents:
52377
diff
changeset
|
105 |
"warning: {@index} tag, which expands to <a>, within <a>"); |
51862 | 106 |
} |
107 |
} |