author | jjg |
Tue, 22 Apr 2014 17:57:40 -0700 | |
changeset 24072 | e7549dcbc4af |
parent 24065 | fc4022e50129 |
child 24399 | af1a0220d0fa |
permissions | -rw-r--r-- |
10 | 1 |
/* |
23971 | 2 |
* Copyright (c) 2003, 2014, 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 |
|
21478
fa4c7cda1b41
8026567: Use meaningful style names for strong and italic styles.
bpatel
parents:
21008
diff
changeset
|
26 |
* @bug 4663254 8016328 8025633 8026567 |
10 | 27 |
* @summary Verify that spaces do not appear in hrefs and anchors. |
28 |
* @author jamieh |
|
29 |
* @library ../lib/ |
|
9083
63f3c4d2d992
7010344: Some of the html files do not have element <a> in right context.
bpatel
parents:
7681
diff
changeset
|
30 |
* @build JavadocTester TestHref |
10 | 31 |
* @run main TestHref |
32 |
*/ |
|
33 |
||
34 |
public class TestHref extends JavadocTester { |
|
35 |
||
36 |
//Javadoc arguments. |
|
37 |
private static final String[] ARGS = new String[] { |
|
24072 | 38 |
"-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "-linkoffline", |
10 | 39 |
"http://java.sun.com/j2se/1.4/docs/api/", SRC_DIR, "pkg" |
40 |
}; |
|
41 |
||
42 |
//Input for string search tests. |
|
43 |
private static final String[][] TEST = { |
|
44 |
//External link. |
|
24072 | 45 |
{ "pkg/C1.html", |
21008
af0b915df7cc
8025633: Fix javadoc to generate valid anchor names
bpatel
parents:
20257
diff
changeset
|
46 |
"href=\"http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html?is-external=true#wait-long-int-\"" |
10 | 47 |
}, |
48 |
//Member summary table link. |
|
24072 | 49 |
{ "pkg/C1.html", |
21008
af0b915df7cc
8025633: Fix javadoc to generate valid anchor names
bpatel
parents:
20257
diff
changeset
|
50 |
"href=\"../pkg/C1.html#method-int-int-java.util.ArrayList-\"" |
10 | 51 |
}, |
52 |
//Anchor test. |
|
24072 | 53 |
{ "pkg/C1.html", |
23971 | 54 |
"<a name=\"method-int-int-java.util.ArrayList-\">\n" + |
55 |
"<!-- -->\n" + |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
56 |
"</a>" |
10 | 57 |
}, |
58 |
//Backward compatibility anchor test. |
|
24072 | 59 |
{ "pkg/C1.html", |
23971 | 60 |
"<a name=\"method-int-int-java.util.ArrayList-\">\n" + |
61 |
"<!-- -->\n" + |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
62 |
"</a>" |
10 | 63 |
}, |
64 |
//{@link} test. |
|
24072 | 65 |
{ "pkg/C2.html", |
21008
af0b915df7cc
8025633: Fix javadoc to generate valid anchor names
bpatel
parents:
20257
diff
changeset
|
66 |
"Link: <a href=\"../pkg/C1.html#method-int-int-java.util.ArrayList-\">" |
10 | 67 |
}, |
68 |
//@see test. |
|
24072 | 69 |
{ "pkg/C2.html", |
23971 | 70 |
"See Also:</span></dt>\n" + |
71 |
"<dd><a href=\"../pkg/C1.html#method-int-int-java.util.ArrayList-\">" |
|
10 | 72 |
}, |
73 |
||
74 |
//Header does not link to the page itself. |
|
24072 | 75 |
{ "pkg/C4.html", |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
76 |
"Class C4<E extends C4<E>></h2>" |
10 | 77 |
}, |
78 |
||
79 |
//Signature does not link to the page itself. |
|
24072 | 80 |
{ "pkg/C4.html", |
21478
fa4c7cda1b41
8026567: Use meaningful style names for strong and italic styles.
bpatel
parents:
21008
diff
changeset
|
81 |
"public abstract class <span class=\"typeNameLabel\">C4<E extends C4<E>></span>" |
10 | 82 |
}, |
83 |
}; |
|
84 |
private static final String[][] NEGATED_TEST = |
|
85 |
{ |
|
86 |
{WARNING_OUTPUT, "<a> tag is malformed"} |
|
87 |
}; |
|
88 |
||
89 |
/** |
|
90 |
* The entry point of the test. |
|
91 |
* @param args the array of command line arguments. |
|
92 |
*/ |
|
93 |
public static void main(String[] args) { |
|
94 |
TestHref tester = new TestHref(); |
|
24065
fc4022e50129
8041150: Avoid silly use of static methods in JavadocTester
jjg
parents:
23971
diff
changeset
|
95 |
tester.run(ARGS, TEST, NEGATED_TEST); |
10 | 96 |
tester.printSummary(); |
97 |
} |
|
98 |
} |