author | jjg |
Fri, 18 Apr 2014 17:25:43 -0700 | |
changeset 24065 | fc4022e50129 |
parent 23971 | f5ff1f5a8dee |
child 24072 | e7549dcbc4af |
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 |
//Test information. |
|
37 |
private static final String BUG_ID = "4663254"; |
|
38 |
||
39 |
//Javadoc arguments. |
|
40 |
private static final String[] ARGS = new String[] { |
|
23139
612191246a7d
8031670: Remove unneeded -source options in javadoc tests
darcy
parents:
21478
diff
changeset
|
41 |
"-d", BUG_ID, "-sourcepath", SRC_DIR, "-linkoffline", |
10 | 42 |
"http://java.sun.com/j2se/1.4/docs/api/", SRC_DIR, "pkg" |
43 |
}; |
|
44 |
||
45 |
//Input for string search tests. |
|
46 |
private static final String[][] TEST = { |
|
47 |
//External link. |
|
23971 | 48 |
{BUG_ID + "/pkg/C1.html", |
21008
af0b915df7cc
8025633: Fix javadoc to generate valid anchor names
bpatel
parents:
20257
diff
changeset
|
49 |
"href=\"http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html?is-external=true#wait-long-int-\"" |
10 | 50 |
}, |
51 |
//Member summary table link. |
|
23971 | 52 |
{BUG_ID + "/pkg/C1.html", |
21008
af0b915df7cc
8025633: Fix javadoc to generate valid anchor names
bpatel
parents:
20257
diff
changeset
|
53 |
"href=\"../pkg/C1.html#method-int-int-java.util.ArrayList-\"" |
10 | 54 |
}, |
55 |
//Anchor test. |
|
23971 | 56 |
{BUG_ID + "/pkg/C1.html", |
57 |
"<a name=\"method-int-int-java.util.ArrayList-\">\n" + |
|
58 |
"<!-- -->\n" + |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
59 |
"</a>" |
10 | 60 |
}, |
61 |
//Backward compatibility anchor test. |
|
23971 | 62 |
{BUG_ID + "/pkg/C1.html", |
63 |
"<a name=\"method-int-int-java.util.ArrayList-\">\n" + |
|
64 |
"<!-- -->\n" + |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
65 |
"</a>" |
10 | 66 |
}, |
67 |
//{@link} test. |
|
23971 | 68 |
{BUG_ID + "/pkg/C2.html", |
21008
af0b915df7cc
8025633: Fix javadoc to generate valid anchor names
bpatel
parents:
20257
diff
changeset
|
69 |
"Link: <a href=\"../pkg/C1.html#method-int-int-java.util.ArrayList-\">" |
10 | 70 |
}, |
71 |
//@see test. |
|
23971 | 72 |
{BUG_ID + "/pkg/C2.html", |
73 |
"See Also:</span></dt>\n" + |
|
74 |
"<dd><a href=\"../pkg/C1.html#method-int-int-java.util.ArrayList-\">" |
|
10 | 75 |
}, |
76 |
||
77 |
//Header does not link to the page itself. |
|
23971 | 78 |
{BUG_ID + "/pkg/C4.html", |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
79 |
"Class C4<E extends C4<E>></h2>" |
10 | 80 |
}, |
81 |
||
82 |
//Signature does not link to the page itself. |
|
23971 | 83 |
{BUG_ID + "/pkg/C4.html", |
21478
fa4c7cda1b41
8026567: Use meaningful style names for strong and italic styles.
bpatel
parents:
21008
diff
changeset
|
84 |
"public abstract class <span class=\"typeNameLabel\">C4<E extends C4<E>></span>" |
10 | 85 |
}, |
86 |
}; |
|
87 |
private static final String[][] NEGATED_TEST = |
|
88 |
{ |
|
89 |
{WARNING_OUTPUT, "<a> tag is malformed"} |
|
90 |
}; |
|
91 |
||
92 |
/** |
|
93 |
* The entry point of the test. |
|
94 |
* @param args the array of command line arguments. |
|
95 |
*/ |
|
96 |
public static void main(String[] args) { |
|
97 |
TestHref tester = new TestHref(); |
|
24065
fc4022e50129
8041150: Avoid silly use of static methods in JavadocTester
jjg
parents:
23971
diff
changeset
|
98 |
tester.run(ARGS, TEST, NEGATED_TEST); |
10 | 99 |
tester.printSummary(); |
100 |
} |
|
101 |
||
102 |
/** |
|
103 |
* {@inheritDoc} |
|
104 |
*/ |
|
105 |
public String getBugId() { |
|
106 |
return BUG_ID; |
|
107 |
} |
|
108 |
||
109 |
/** |
|
110 |
* {@inheritDoc} |
|
111 |
*/ |
|
112 |
public String getBugName() { |
|
113 |
return getClass().getName(); |
|
114 |
} |
|
115 |
} |