test/com/sun/javadoc/testAnchorNames/TestAnchorNames.java

Mon, 23 Jan 2017 17:03:12 -0800

author
asaha
date
Mon, 23 Jan 2017 17:03:12 -0800
changeset 3376
26c9abc6c440
parent 2192
5ae66d372d57
child 2525
2eb010b6cb22
permissions
-rw-r--r--

Merge

bpatel@2101 1 /*
bpatel@2101 2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
bpatel@2101 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
bpatel@2101 4 *
bpatel@2101 5 * This code is free software; you can redistribute it and/or modify it
bpatel@2101 6 * under the terms of the GNU General Public License version 2 only, as
bpatel@2101 7 * published by the Free Software Foundation.
bpatel@2101 8 *
bpatel@2101 9 * This code is distributed in the hope that it will be useful, but WITHOUT
bpatel@2101 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
bpatel@2101 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
bpatel@2101 12 * version 2 for more details (a copy is included in the LICENSE file that
bpatel@2101 13 * accompanied this code).
bpatel@2101 14 *
bpatel@2101 15 * You should have received a copy of the GNU General Public License version
bpatel@2101 16 * 2 along with this work; if not, write to the Free Software Foundation,
bpatel@2101 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
bpatel@2101 18 *
bpatel@2101 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
bpatel@2101 20 * or visit www.oracle.com if you need additional information or have any
bpatel@2101 21 * questions.
bpatel@2101 22 */
bpatel@2101 23
bpatel@2101 24 /*
bpatel@2101 25 * @test
bpatel@2192 26 * @bug 8025633 8025524
bpatel@2101 27 * @summary Test for valid name attribute in HTML anchors.
bpatel@2101 28 * @author Bhavesh Patel
bpatel@2101 29 * @library ../lib/
bpatel@2101 30 * @build JavadocTester TestAnchorNames
bpatel@2101 31 * @run main TestAnchorNames
bpatel@2101 32 */
bpatel@2101 33
bpatel@2101 34 public class TestAnchorNames extends JavadocTester {
bpatel@2101 35
bpatel@2101 36 private static final String BUG_ID = "8025633";
bpatel@2101 37
bpatel@2101 38 //Input for string search tests.
bpatel@2101 39 private static final String[][] TEST = {
bpatel@2101 40
bpatel@2101 41 //Test some section markers and links to these markers
bpatel@2101 42
bpatel@2101 43 {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
bpatel@2101 44 "<a name=\"skip.navbar.top\">"
bpatel@2101 45 },
bpatel@2101 46 {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
bpatel@2101 47 "<a href=\"#skip.navbar.top\" title=\"Skip navigation links\">"
bpatel@2101 48 },
bpatel@2101 49 {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
bpatel@2101 50 "<a name=\"nested.class.summary\">"
bpatel@2101 51 },
bpatel@2101 52 {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
bpatel@2101 53 "<a href=\"#nested.class.summary\">"
bpatel@2101 54 },
bpatel@2101 55 {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
bpatel@2101 56 "<a name=\"method.summary\">"
bpatel@2101 57 },
bpatel@2101 58 {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
bpatel@2101 59 "<a href=\"#method.summary\">"
bpatel@2101 60 },
bpatel@2101 61 {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
bpatel@2101 62 "<a name=\"field.detail\">"
bpatel@2101 63 },
bpatel@2101 64 {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
bpatel@2101 65 "<a href=\"#field.detail\">"
bpatel@2101 66 },
bpatel@2101 67 {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
bpatel@2101 68 "<a name=\"constructor.detail\">"
bpatel@2101 69 },
bpatel@2101 70 {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
bpatel@2101 71 "<a href=\"#constructor.detail\">"
bpatel@2101 72 },
bpatel@2101 73
bpatel@2101 74 //Test some members and link to these members
bpatel@2101 75
bpatel@2101 76 //The marker for this appears in the serialized-form.html which we will
bpatel@2101 77 //test below
bpatel@2101 78 {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
bpatel@2101 79 "<a href=\"../serialized-form.html#pkg1.RegClass\">"
bpatel@2101 80 },
bpatel@2101 81 //Test some fields
bpatel@2101 82 {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
bpatel@2101 83 "<a name=\"Z:Z_\">"
bpatel@2101 84 },
bpatel@2101 85 {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
bpatel@2101 86 "<a href=\"../pkg1/RegClass.html#Z:Z_\">"
bpatel@2101 87 },
bpatel@2101 88 {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
bpatel@2101 89 "<a name=\"Z:Z_:D\">"
bpatel@2101 90 },
bpatel@2101 91 {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
bpatel@2101 92 "<a href=\"../pkg1/RegClass.html#Z:Z_:D\">"
bpatel@2101 93 },
bpatel@2101 94 {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
bpatel@2101 95 "<a name=\"Z:Z:D_\">"
bpatel@2101 96 },
bpatel@2101 97 {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
bpatel@2101 98 "<a href=\"../pkg1/RegClass.html#Z:Z:D_\">"
bpatel@2101 99 },
bpatel@2101 100 {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
bpatel@2101 101 "<a name=\"Z:Z:Dfield\">"
bpatel@2101 102 },
bpatel@2101 103 {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
bpatel@2101 104 "<a href=\"../pkg1/RegClass.html#Z:Z:Dfield\">"
bpatel@2101 105 },
bpatel@2101 106 {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
bpatel@2101 107 "<a name=\"fieldInCla:D:D\">"
bpatel@2101 108 },
bpatel@2101 109 {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
bpatel@2101 110 "<a href=\"../pkg1/RegClass.html#fieldInCla:D:D\">"
bpatel@2101 111 },
bpatel@2101 112 {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
bpatel@2101 113 "<a name=\"S_:D:D:D:D:DINT\">"
bpatel@2101 114 },
bpatel@2101 115 {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
bpatel@2101 116 "<a href=\"../pkg1/RegClass.html#S_:D:D:D:D:DINT\">"
bpatel@2101 117 },
bpatel@2101 118 {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
bpatel@2101 119 "<a name=\"method:D:D\">"
bpatel@2101 120 },
bpatel@2101 121 {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
bpatel@2101 122 "<a href=\"../pkg1/RegClass.html#method:D:D\">"
bpatel@2101 123 },
bpatel@2101 124 {BUG_ID + FS + "pkg1" + FS + "DeprMemClass.html",
bpatel@2101 125 "<a name=\"Z:Z_field_In_Class\">"
bpatel@2101 126 },
bpatel@2101 127 {BUG_ID + FS + "pkg1" + FS + "DeprMemClass.html",
bpatel@2101 128 "<a href=\"../pkg1/DeprMemClass.html#Z:Z_field_In_Class\">"
bpatel@2101 129 },
bpatel@2101 130 //Test constructor
bpatel@2101 131 {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
bpatel@2101 132 "<a name=\"RegClass-java.lang.String-int-\">"
bpatel@2101 133 },
bpatel@2101 134 {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
bpatel@2101 135 "<a href=\"../pkg1/RegClass.html#RegClass-java.lang.String-int-\">"
bpatel@2101 136 },
bpatel@2101 137 //Test some methods
bpatel@2101 138 {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
bpatel@2101 139 "<a name=\"Z:Z_methodInClass-java.lang.String-\">"
bpatel@2101 140 },
bpatel@2101 141 {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
bpatel@2101 142 "<a href=\"../pkg1/RegClass.html#Z:Z_methodInClass-java.lang.String-\">"
bpatel@2101 143 },
bpatel@2101 144 {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
bpatel@2101 145 "<a name=\"method--\">"
bpatel@2101 146 },
bpatel@2101 147 {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
bpatel@2101 148 "<a href=\"../pkg1/RegClass.html#method--\">"
bpatel@2101 149 },
bpatel@2101 150 {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
bpatel@2101 151 "<a name=\"foo-java.util.Map-\">"
bpatel@2101 152 },
bpatel@2101 153 {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
bpatel@2101 154 "<a href=\"../pkg1/RegClass.html#foo-java.util.Map-\">"
bpatel@2101 155 },
bpatel@2101 156 {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
bpatel@2101 157 "<a name=\"methodInCla:Ds-java.lang.String:A-\">"
bpatel@2101 158 },
bpatel@2101 159 {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
bpatel@2101 160 "<a href=\"../pkg1/RegClass.html#methodInCla:Ds-java.lang.String:A-\">"
bpatel@2101 161 },
bpatel@2101 162 {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
bpatel@2101 163 "<a name=\"Z:Z_methodInClas:D-java.lang.String-int-\">"
bpatel@2101 164 },
bpatel@2101 165 {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
bpatel@2101 166 "<a href=\"../pkg1/RegClass.html#Z:Z_methodInClas:D-java.lang.String-int-\">"
bpatel@2101 167 },
bpatel@2101 168 {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
bpatel@2101 169 "<a name=\"methodD-pkg1.RegClass.:DA-\">"
bpatel@2101 170 },
bpatel@2101 171 {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
bpatel@2101 172 "<a href=\"../pkg1/RegClass.html#methodD-pkg1.RegClass.:DA-\">"
bpatel@2101 173 },
bpatel@2101 174 {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
bpatel@2101 175 "<a name=\"methodD-pkg1.RegClass.D:A-\">"
bpatel@2101 176 },
bpatel@2101 177 {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
bpatel@2101 178 "<a href=\"../pkg1/RegClass.html#methodD-pkg1.RegClass.D:A-\">"
bpatel@2101 179 },
bpatel@2101 180 {BUG_ID + FS + "pkg1" + FS + "DeprMemClass.html",
bpatel@2101 181 "<a name=\"Z:Z:Dmethod_In_Class--\">"
bpatel@2101 182 },
bpatel@2101 183 {BUG_ID + FS + "pkg1" + FS + "DeprMemClass.html",
bpatel@2101 184 "<a href=\"../pkg1/DeprMemClass.html#Z:Z:Dmethod_In_Class--\">"
bpatel@2101 185 },
bpatel@2101 186
bpatel@2101 187 //Test enum
bpatel@2101 188
bpatel@2101 189 {BUG_ID + FS + "pkg1" + FS + "RegClass.Te$t_Enum.html",
bpatel@2101 190 "<a name=\"Z:Z:DFLD2\">"
bpatel@2101 191 },
bpatel@2101 192 {BUG_ID + FS + "pkg1" + FS + "RegClass.Te$t_Enum.html",
bpatel@2101 193 "<a href=\"../pkg1/RegClass.Te$t_Enum.html#Z:Z:DFLD2\">"
bpatel@2101 194 },
bpatel@2101 195
bpatel@2101 196 //Test nested class
bpatel@2101 197
bpatel@2101 198 {BUG_ID + FS + "pkg1" + FS + "RegClass._NestedClas$.html",
bpatel@2192 199 "<a name=\"Z:Z_NestedClas:D--\">"
bpatel@2101 200 },
bpatel@2101 201 {BUG_ID + FS + "pkg1" + FS + "RegClass._NestedClas$.html",
bpatel@2192 202 "<a href=\"../pkg1/RegClass._NestedClas$.html#Z:Z_NestedClas:D--\">"
bpatel@2101 203 },
bpatel@2101 204
bpatel@2101 205 //Test class use page
bpatel@2101 206
bpatel@2101 207 {BUG_ID + FS + "pkg1" + FS + "class-use" + FS + "DeprMemClass.html",
bpatel@2101 208 "<a href=\"../../pkg1/RegClass.html#d____mc\">"
bpatel@2101 209 },
bpatel@2101 210
bpatel@2101 211 //Test deprecated list page
bpatel@2101 212
bpatel@2101 213 {BUG_ID + FS + "deprecated-list.html",
bpatel@2101 214 "<a href=\"pkg1/DeprMemClass.html#Z:Z_field_In_Class\">"
bpatel@2101 215 },
bpatel@2101 216 {BUG_ID + FS + "deprecated-list.html",
bpatel@2101 217 "<a href=\"pkg1/DeprMemClass.html#Z:Z:Dmethod_In_Class--\">"
bpatel@2101 218 },
bpatel@2101 219
bpatel@2101 220 //Test constant values page
bpatel@2101 221
bpatel@2101 222 {BUG_ID + FS + "constant-values.html",
bpatel@2101 223 "<a href=\"pkg1/RegClass.html#S_:D:D:D:D:DINT\">"
bpatel@2101 224 },
bpatel@2101 225
bpatel@2101 226 //Test serialized form page
bpatel@2101 227
bpatel@2101 228 //This is the marker for the link that appears in the pkg1.RegClass.html page
bpatel@2101 229 {BUG_ID + FS + "serialized-form.html",
bpatel@2101 230 "<a name=\"pkg1.RegClass\">"
bpatel@2101 231 },
bpatel@2101 232
bpatel@2101 233 //Test member name index page
bpatel@2101 234
bpatel@2101 235 {BUG_ID + FS + "index-all.html",
bpatel@2101 236 "<a name=\"I:Z:Z:D\">"
bpatel@2101 237 },
bpatel@2101 238 {BUG_ID + FS + "index-all.html",
bpatel@2101 239 "<a href=\"#I:Z:Z:D\">$"
bpatel@2101 240 },
bpatel@2101 241 {BUG_ID + FS + "index-all.html",
bpatel@2101 242 "<a href=\"#I:Z:Z_\">_"
bpatel@2101 243 }
bpatel@2101 244 };
bpatel@2101 245
bpatel@2101 246 private static final String[][] NEGATED_TEST = {
bpatel@2101 247 //The marker name conversion should only affect HTML anchors. It should not
bpatel@2101 248 //affect the lables.
bpatel@2101 249 {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
bpatel@2101 250 " Z:Z_"
bpatel@2101 251 },
bpatel@2101 252 {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
bpatel@2101 253 " Z:Z:Dfield"
bpatel@2101 254 },
bpatel@2101 255 {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
bpatel@2101 256 " Z:Z_field_In_Class"
bpatel@2101 257 },
bpatel@2101 258 {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
bpatel@2101 259 " S_:D:D:D:D:DINT"
bpatel@2101 260 },
bpatel@2101 261 };
bpatel@2101 262
bpatel@2101 263 private static final String[] ARGS = new String[] {
bpatel@2101 264 "-d", BUG_ID, "-sourcepath", SRC_DIR, "-use", "pkg1"
bpatel@2101 265 };
bpatel@2101 266
bpatel@2101 267 /**
bpatel@2101 268 * The entry point of the test.
bpatel@2101 269 * @param args the array of command line arguments.
bpatel@2101 270 */
bpatel@2101 271 public static void main(String[] args) throws Exception {
bpatel@2101 272 TestAnchorNames tester = new TestAnchorNames();
bpatel@2101 273 run(tester, ARGS, TEST, NEGATED_TEST);
bpatel@2101 274 tester.printSummary();
bpatel@2101 275 }
bpatel@2101 276
bpatel@2101 277 /**
bpatel@2101 278 * {@inheritDoc}
bpatel@2101 279 */
bpatel@2101 280 public String getBugId() {
bpatel@2101 281 return BUG_ID;
bpatel@2101 282 }
bpatel@2101 283
bpatel@2101 284 /**
bpatel@2101 285 * {@inheritDoc}
bpatel@2101 286 */
bpatel@2101 287 public String getBugName() {
bpatel@2101 288 return getClass().getName();
bpatel@2101 289 }
bpatel@2101 290 }

mercurial