author | lana |
Wed, 02 Dec 2015 15:55:53 -0800 | |
changeset 34471 | bb836644836b |
parent 31297 | 86fe1414f12c |
permissions | -rw-r--r-- |
10 | 1 |
/* |
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
26900
diff
changeset
|
2 |
* Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved. |
10 | 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 |
|
7 |
* published by the Free Software Foundation. |
|
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 |
* |
|
5520 | 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. |
|
10 | 22 |
*/ |
23 |
||
24 |
/* |
|
25 |
* @test |
|
31297
86fe1414f12c
8081854: Javadoc should generate named anchors for HTML4 output
bpatel
parents:
30730
diff
changeset
|
26 |
* @bug 4496290 4985072 7006178 7068595 8016328 8050031 8048351 8081854 |
26270
a3635e6d3d78
8050031: [javadoc] class-use pages have duplicates and missing entries
ksrini
parents:
25450
diff
changeset
|
27 |
* @summary A simple test to ensure class-use files are correct. |
10 | 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:
29957
diff
changeset
|
30 |
* @modules jdk.javadoc |
10 | 31 |
* @build JavadocTester |
32 |
* @run main TestUseOption |
|
33 |
*/ |
|
34 |
||
35 |
public class TestUseOption extends JavadocTester { |
|
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 |
TestUseOption tester = new TestUseOption(); |
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 |
} |
10 | 41 |
|
24399
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 test1() { |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
44 |
javadoc("-d", "out-1", |
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 |
"-use", |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
47 |
"pkg1", "pkg2"); |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
48 |
checkExit(Exit.OK); |
8841
b4422fa4f2e6
7006178: findbugs high priority issues in new javadoc
bpatel
parents:
5520
diff
changeset
|
49 |
|
24399
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
50 |
// Eight tests for class use. |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
51 |
for (int i = 1; i <= 8; i++) { |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
52 |
checkOutput("pkg1/class-use/C1.html", true, |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
53 |
"Test " + i + " passes"); |
14060
ae69cea86e83
7068595: html files in class-use dir do not get loaded correctly when Frames link is clicked
bpatel
parents:
8841
diff
changeset
|
54 |
} |
ae69cea86e83
7068595: html files in class-use dir do not get loaded correctly when Frames link is clicked
bpatel
parents:
8841
diff
changeset
|
55 |
|
24399
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
56 |
// Three more tests for package use. |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
57 |
for (int i = 1; i <= 3; i++) { |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
58 |
checkOutput("pkg1/package-use.html", true, |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
59 |
"Test " + i + " passes"); |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
60 |
} |
10 | 61 |
|
24399
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
62 |
checkOrder("pkg1/class-use/UsedClass.html", |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
63 |
"Field in C1.", |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
64 |
"Field in C2.", |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
65 |
"Field in C4.", |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
66 |
"Field in C5.", |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
67 |
"Field in C6.", |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
68 |
"Field in C7.", |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
69 |
"Field in C8.", |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
70 |
"Method in C1.", |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
71 |
"Method in C2.", |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
72 |
"Method in C4.", |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
73 |
"Method in C5.", |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
74 |
"Method in C6.", |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
75 |
"Method in C7.", |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
76 |
"Method in C8." |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
77 |
); |
14060
ae69cea86e83
7068595: html files in class-use dir do not get loaded correctly when Frames link is clicked
bpatel
parents:
8841
diff
changeset
|
78 |
|
24399
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
79 |
checkOutput("pkg2/class-use/C3.html", true, |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
80 |
"<a href=\"../../index.html?pkg2/class-use/C3.html\" target=\"_top\">" |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
81 |
+ "Frames</a></li>" |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
82 |
); |
25284
e6a8d468b838
8047157: [javadoc] fixup tests for determinism and add classes uses
ksrini
parents:
24399
diff
changeset
|
83 |
checkOutput("pkg1/class-use/UsedClass.html", true, |
e6a8d468b838
8047157: [javadoc] fixup tests for determinism and add classes uses
ksrini
parents:
24399
diff
changeset
|
84 |
"that return types with arguments of type" |
e6a8d468b838
8047157: [javadoc] fixup tests for determinism and add classes uses
ksrini
parents:
24399
diff
changeset
|
85 |
); |
e6a8d468b838
8047157: [javadoc] fixup tests for determinism and add classes uses
ksrini
parents:
24399
diff
changeset
|
86 |
checkOutput("pkg1/class-use/UsedClass.html", true, |
e6a8d468b838
8047157: [javadoc] fixup tests for determinism and add classes uses
ksrini
parents:
24399
diff
changeset
|
87 |
"<a href=\"../../pkg1/C1.html#methodInC1ReturningType--\">methodInC1ReturningType</a>" |
e6a8d468b838
8047157: [javadoc] fixup tests for determinism and add classes uses
ksrini
parents:
24399
diff
changeset
|
88 |
); |
e6a8d468b838
8047157: [javadoc] fixup tests for determinism and add classes uses
ksrini
parents:
24399
diff
changeset
|
89 |
checkOutput("pkg1/class-use/UsedInterface.html", true, |
e6a8d468b838
8047157: [javadoc] fixup tests for determinism and add classes uses
ksrini
parents:
24399
diff
changeset
|
90 |
"Classes in <a href=\"../../pkg1/package-summary.html\">pkg1</a> that implement " + |
e6a8d468b838
8047157: [javadoc] fixup tests for determinism and add classes uses
ksrini
parents:
24399
diff
changeset
|
91 |
"<a href=\"../../pkg1/UsedInterface.html\" title=\"interface in pkg1\">UsedInterface</a>" |
e6a8d468b838
8047157: [javadoc] fixup tests for determinism and add classes uses
ksrini
parents:
24399
diff
changeset
|
92 |
); |
e6a8d468b838
8047157: [javadoc] fixup tests for determinism and add classes uses
ksrini
parents:
24399
diff
changeset
|
93 |
checkOutput("pkg1/class-use/UsedInterfaceA.html", true, |
e6a8d468b838
8047157: [javadoc] fixup tests for determinism and add classes uses
ksrini
parents:
24399
diff
changeset
|
94 |
"Classes in <a href=\"../../pkg1/package-summary.html\">pkg1</a> that implement " + |
e6a8d468b838
8047157: [javadoc] fixup tests for determinism and add classes uses
ksrini
parents:
24399
diff
changeset
|
95 |
"<a href=\"../../pkg1/UsedInterfaceA.html\" title=\"interface in pkg1\">UsedInterfaceA</a>" |
e6a8d468b838
8047157: [javadoc] fixup tests for determinism and add classes uses
ksrini
parents:
24399
diff
changeset
|
96 |
); |
e6a8d468b838
8047157: [javadoc] fixup tests for determinism and add classes uses
ksrini
parents:
24399
diff
changeset
|
97 |
checkOutput("pkg1/class-use/UsedClass.html", false, |
e6a8d468b838
8047157: [javadoc] fixup tests for determinism and add classes uses
ksrini
parents:
24399
diff
changeset
|
98 |
"methodInC1Protected" |
e6a8d468b838
8047157: [javadoc] fixup tests for determinism and add classes uses
ksrini
parents:
24399
diff
changeset
|
99 |
); |
25450 | 100 |
checkOutput("pkg1/class-use/UsedInterface.html", true, |
101 |
"<a href=\"../../pkg1/AnAbstract.html\" title=\"class in pkg1\">AnAbstract</a>" |
|
102 |
); |
|
103 |
checkOutput("pkg1/class-use/UsedInterface.html", true, |
|
104 |
"../../pkg1/C10.html#withReturningTypeParameters--" |
|
105 |
); |
|
106 |
checkOutput("pkg1/class-use/UsedInterface.html", true, |
|
107 |
"../../pkg1/C10.html#withTypeParametersOfType-java.lang.Class-" |
|
108 |
); |
|
109 |
checkOutput("pkg1/class-use/UsedInterface.html", true, |
|
110 |
"\"../../pkg1/package-summary.html\">pkg1</a> that return " + |
|
111 |
"<a href=\"../../pkg1/UsedInterface.html\" title=\"interface in pkg1\"" |
|
112 |
); |
|
113 |
checkOutput("pkg1/class-use/UsedInterface.html", true, |
|
114 |
"<a href=\"../../pkg1/C10.html#addAll-pkg1.UsedInterface...-\">addAll</a>" |
|
115 |
); |
|
116 |
checkOutput("pkg1/class-use/UsedInterface.html", true, |
|
117 |
"<a href=\"../../pkg1/C10.html#create-pkg1.UsedInterfaceA-pkg1." + |
|
118 |
"UsedInterface-java.lang.String-\">" |
|
119 |
); |
|
120 |
checkOutput("pkg1/class-use/UsedInterface.html", true, |
|
121 |
"<a href=\"../../pkg1/C10.html#withTypeParametersOfType-java.lang.Class-\">" + |
|
122 |
"withTypeParametersOfType</a>" |
|
123 |
); |
|
24399
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
124 |
} |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
125 |
|
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
126 |
@Test |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
127 |
void test2() { |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
128 |
javadoc("-d", "out-2", |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
129 |
"-sourcepath", testSrc, |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
130 |
"-use", |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
131 |
testSrc("C.java"), testSrc("UsedInC.java")); |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
132 |
checkExit(Exit.OK); |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
133 |
|
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
134 |
checkOutput("class-use/UsedInC.html", true, |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
135 |
"Uses of <a href=\"../UsedInC.html\" title=\"class in <Unnamed>\">" |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
136 |
+ "UsedInC</a> in <a href=\"../package-summary.html\"><Unnamed></a>" |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
137 |
); |
26900
dccc7a72526d
8048351: tidy errors for attribute href, name for langtools javadoc tests needs investigation
bpatel
parents:
26270
diff
changeset
|
138 |
checkOutput("class-use/UsedInC.html", true, |
31297
86fe1414f12c
8081854: Javadoc should generate named anchors for HTML4 output
bpatel
parents:
30730
diff
changeset
|
139 |
"<li class=\"blockList\"><a name=\"unnamed.package\">" |
26900
dccc7a72526d
8048351: tidy errors for attribute href, name for langtools javadoc tests needs investigation
bpatel
parents:
26270
diff
changeset
|
140 |
); |
24399
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
141 |
checkOutput("package-use.html", true, |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
142 |
"<td class=\"colOne\">" |
26900
dccc7a72526d
8048351: tidy errors for attribute href, name for langtools javadoc tests needs investigation
bpatel
parents:
26270
diff
changeset
|
143 |
+ "<a href=\"class-use/UsedInC.html#unnamed.package\">UsedInC</a> </td>" |
24399
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
144 |
); |
10 | 145 |
} |
26270
a3635e6d3d78
8050031: [javadoc] class-use pages have duplicates and missing entries
ksrini
parents:
25450
diff
changeset
|
146 |
|
a3635e6d3d78
8050031: [javadoc] class-use pages have duplicates and missing entries
ksrini
parents:
25450
diff
changeset
|
147 |
@Test |
a3635e6d3d78
8050031: [javadoc] class-use pages have duplicates and missing entries
ksrini
parents:
25450
diff
changeset
|
148 |
void test3() { |
a3635e6d3d78
8050031: [javadoc] class-use pages have duplicates and missing entries
ksrini
parents:
25450
diff
changeset
|
149 |
javadoc("-d", "out-3", |
a3635e6d3d78
8050031: [javadoc] class-use pages have duplicates and missing entries
ksrini
parents:
25450
diff
changeset
|
150 |
"-sourcepath", testSrc, |
a3635e6d3d78
8050031: [javadoc] class-use pages have duplicates and missing entries
ksrini
parents:
25450
diff
changeset
|
151 |
"-use", |
a3635e6d3d78
8050031: [javadoc] class-use pages have duplicates and missing entries
ksrini
parents:
25450
diff
changeset
|
152 |
"-package", "unique"); |
a3635e6d3d78
8050031: [javadoc] class-use pages have duplicates and missing entries
ksrini
parents:
25450
diff
changeset
|
153 |
checkExit(Exit.OK); |
a3635e6d3d78
8050031: [javadoc] class-use pages have duplicates and missing entries
ksrini
parents:
25450
diff
changeset
|
154 |
checkUnique("unique/class-use/UseMe.html", |
a3635e6d3d78
8050031: [javadoc] class-use pages have duplicates and missing entries
ksrini
parents:
25450
diff
changeset
|
155 |
"<a href=\"../../unique/C1.html#umethod1-unique.UseMe-unique.UseMe:A-\">", |
a3635e6d3d78
8050031: [javadoc] class-use pages have duplicates and missing entries
ksrini
parents:
25450
diff
changeset
|
156 |
"<a href=\"../../unique/C1.html#umethod2-unique.UseMe-unique.UseMe-\">", |
a3635e6d3d78
8050031: [javadoc] class-use pages have duplicates and missing entries
ksrini
parents:
25450
diff
changeset
|
157 |
"<a href=\"../../unique/C1.html#umethod3-unique.UseMe-unique.UseMe-\">", |
a3635e6d3d78
8050031: [javadoc] class-use pages have duplicates and missing entries
ksrini
parents:
25450
diff
changeset
|
158 |
"<a href=\"../../unique/C1.html#C1-unique.UseMe-unique.UseMe-\">"); |
a3635e6d3d78
8050031: [javadoc] class-use pages have duplicates and missing entries
ksrini
parents:
25450
diff
changeset
|
159 |
} |
10 | 160 |
} |