author | kamg |
Wed, 12 Jan 2011 15:27:43 -0800 | |
changeset 7979 | 0ae19fac0c55 |
parent 7681 | 1f0819a3341f |
child 9083 | 63f3c4d2d992 |
permissions | -rw-r--r-- |
10 | 1 |
/* |
7681 | 2 |
* Copyright (c) 2003, 2010, 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 |
|
26 |
* @bug 4663254 |
|
27 |
* @summary Verify that spaces do not appear in hrefs and anchors. |
|
28 |
* @author jamieh |
|
29 |
* @library ../lib/ |
|
30 |
* @build JavadocTester |
|
31 |
* @build TestHref |
|
32 |
* @run main TestHref |
|
33 |
*/ |
|
34 |
||
35 |
public class TestHref extends JavadocTester { |
|
36 |
||
37 |
//Test information. |
|
38 |
private static final String BUG_ID = "4663254"; |
|
39 |
||
40 |
//Javadoc arguments. |
|
41 |
private static final String[] ARGS = new String[] { |
|
42 |
"-d", BUG_ID, "-source", "1.5", "-sourcepath", SRC_DIR, "-linkoffline", |
|
43 |
"http://java.sun.com/j2se/1.4/docs/api/", SRC_DIR, "pkg" |
|
44 |
}; |
|
45 |
||
46 |
//Input for string search tests. |
|
47 |
private static final String[][] TEST = { |
|
48 |
//External link. |
|
49 |
{BUG_ID + FS + "pkg" + FS + "C1.html", |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
50 |
"href=\"http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html?is-external=true#wait(long, int)\"" |
10 | 51 |
}, |
52 |
//Member summary table link. |
|
53 |
{BUG_ID + FS + "pkg" + FS + "C1.html", |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
54 |
"href=\"../pkg/C1.html#method(int, int, java.util.ArrayList)\"" |
10 | 55 |
}, |
56 |
//Anchor test. |
|
57 |
{BUG_ID + FS + "pkg" + FS + "C1.html", |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
58 |
"<a name=\"method(int, int, java.util.ArrayList)\">" + NL + |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
59 |
"<!-- -->" + NL + |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
60 |
"</a>" |
10 | 61 |
}, |
62 |
//Backward compatibility anchor test. |
|
63 |
{BUG_ID + FS + "pkg" + FS + "C1.html", |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
64 |
"<a name=\"method(int, int, java.util.ArrayList)\">" + NL + |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
65 |
"<!-- -->" + NL + |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
66 |
"</a>" |
10 | 67 |
}, |
68 |
//{@link} test. |
|
69 |
{BUG_ID + FS + "pkg" + FS + "C2.html", |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
70 |
"Link: <a href=\"../pkg/C1.html#method(int, int, java.util.ArrayList)\">" |
10 | 71 |
}, |
72 |
//@see test. |
|
73 |
{BUG_ID + FS + "pkg" + FS + "C2.html", |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
74 |
"See Also:</span></dt><dd><a href=\"../pkg/C1.html#method(int, int, java.util.ArrayList)\">" |
10 | 75 |
}, |
76 |
||
77 |
//Header does not link to the page itself. |
|
78 |
{BUG_ID + FS + "pkg" + FS + "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. |
|
83 |
{BUG_ID + FS + "pkg" + FS + "C4.html", |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
84 |
"public abstract class <strong>C4<E extends C4<E>></strong>" |
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(); |
|
98 |
run(tester, ARGS, TEST, NEGATED_TEST); |
|
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 |
} |