--- a/langtools/test/com/sun/javadoc/testAnchorNames/TestAnchorNames.java Fri May 09 23:31:05 2014 +0200
+++ b/langtools/test/com/sun/javadoc/testAnchorNames/TestAnchorNames.java Fri May 09 15:37:12 2014 -0700
@@ -26,250 +26,136 @@
* @bug 8025633 8025524
* @summary Test for valid name attribute in HTML anchors.
* @author Bhavesh Patel
- * @library ../lib/
- * @build JavadocTester TestAnchorNames
+ * @library ../lib
+ * @build JavadocTester
* @run main TestAnchorNames
*/
public class TestAnchorNames extends JavadocTester {
-
- //Input for string search tests.
- private static final String[][] TEST = {
-
- //Test some section markers and links to these markers
-
- { "pkg1/RegClass.html",
- "<a name=\"skip.navbar.top\">"
- },
- { "pkg1/RegClass.html",
- "<a href=\"#skip.navbar.top\" title=\"Skip navigation links\">"
- },
- { "pkg1/RegClass.html",
- "<a name=\"nested.class.summary\">"
- },
- { "pkg1/RegClass.html",
- "<a href=\"#nested.class.summary\">"
- },
- { "pkg1/RegClass.html",
- "<a name=\"method.summary\">"
- },
- { "pkg1/RegClass.html",
- "<a href=\"#method.summary\">"
- },
- { "pkg1/RegClass.html",
- "<a name=\"field.detail\">"
- },
- { "pkg1/RegClass.html",
- "<a href=\"#field.detail\">"
- },
- { "pkg1/RegClass.html",
- "<a name=\"constructor.detail\">"
- },
- { "pkg1/RegClass.html",
- "<a href=\"#constructor.detail\">"
- },
-
- //Test some members and link to these members
+ private static final String[] ARGS = new String[] {
- //The marker for this appears in the serialized-form.html which we will
- //test below
- { "pkg1/RegClass.html",
- "<a href=\"../serialized-form.html#pkg1.RegClass\">"
- },
- //Test some fields
- { "pkg1/RegClass.html",
- "<a name=\"Z:Z_\">"
- },
- { "pkg1/RegClass.html",
- "<a href=\"../pkg1/RegClass.html#Z:Z_\">"
- },
- { "pkg1/RegClass.html",
- "<a name=\"Z:Z_:D\">"
- },
- { "pkg1/RegClass.html",
- "<a href=\"../pkg1/RegClass.html#Z:Z_:D\">"
- },
- { "pkg1/RegClass.html",
- "<a name=\"Z:Z:D_\">"
- },
- { "pkg1/RegClass.html",
- "<a href=\"../pkg1/RegClass.html#Z:Z:D_\">"
- },
- { "pkg1/RegClass.html",
- "<a name=\"Z:Z:Dfield\">"
- },
- { "pkg1/RegClass.html",
- "<a href=\"../pkg1/RegClass.html#Z:Z:Dfield\">"
- },
- { "pkg1/RegClass.html",
- "<a name=\"fieldInCla:D:D\">"
- },
- { "pkg1/RegClass.html",
- "<a href=\"../pkg1/RegClass.html#fieldInCla:D:D\">"
- },
- { "pkg1/RegClass.html",
- "<a name=\"S_:D:D:D:D:DINT\">"
- },
- { "pkg1/RegClass.html",
- "<a href=\"../pkg1/RegClass.html#S_:D:D:D:D:DINT\">"
- },
- { "pkg1/RegClass.html",
- "<a name=\"method:D:D\">"
- },
- { "pkg1/RegClass.html",
- "<a href=\"../pkg1/RegClass.html#method:D:D\">"
- },
- { "pkg1/DeprMemClass.html",
- "<a name=\"Z:Z_field_In_Class\">"
- },
- { "pkg1/DeprMemClass.html",
- "<a href=\"../pkg1/DeprMemClass.html#Z:Z_field_In_Class\">"
- },
- //Test constructor
- { "pkg1/RegClass.html",
- "<a name=\"RegClass-java.lang.String-int-\">"
- },
- { "pkg1/RegClass.html",
- "<a href=\"../pkg1/RegClass.html#RegClass-java.lang.String-int-\">"
- },
- //Test some methods
- { "pkg1/RegClass.html",
- "<a name=\"Z:Z_methodInClass-java.lang.String-\">"
- },
- { "pkg1/RegClass.html",
- "<a href=\"../pkg1/RegClass.html#Z:Z_methodInClass-java.lang.String-\">"
- },
- { "pkg1/RegClass.html",
- "<a name=\"method--\">"
- },
- { "pkg1/RegClass.html",
- "<a href=\"../pkg1/RegClass.html#method--\">"
- },
- { "pkg1/RegClass.html",
- "<a name=\"foo-java.util.Map-\">"
- },
- { "pkg1/RegClass.html",
- "<a href=\"../pkg1/RegClass.html#foo-java.util.Map-\">"
- },
- { "pkg1/RegClass.html",
- "<a name=\"methodInCla:Ds-java.lang.String:A-\">"
- },
- { "pkg1/RegClass.html",
- "<a href=\"../pkg1/RegClass.html#methodInCla:Ds-java.lang.String:A-\">"
- },
- { "pkg1/RegClass.html",
- "<a name=\"Z:Z_methodInClas:D-java.lang.String-int-\">"
- },
- { "pkg1/RegClass.html",
- "<a href=\"../pkg1/RegClass.html#Z:Z_methodInClas:D-java.lang.String-int-\">"
- },
- { "pkg1/RegClass.html",
- "<a name=\"methodD-pkg1.RegClass.:DA-\">"
- },
- { "pkg1/RegClass.html",
- "<a href=\"../pkg1/RegClass.html#methodD-pkg1.RegClass.:DA-\">"
- },
- { "pkg1/RegClass.html",
- "<a name=\"methodD-pkg1.RegClass.D:A-\">"
- },
- { "pkg1/RegClass.html",
- "<a href=\"../pkg1/RegClass.html#methodD-pkg1.RegClass.D:A-\">"
- },
- { "pkg1/DeprMemClass.html",
- "<a name=\"Z:Z:Dmethod_In_Class--\">"
- },
- { "pkg1/DeprMemClass.html",
- "<a href=\"../pkg1/DeprMemClass.html#Z:Z:Dmethod_In_Class--\">"
- },
-
- //Test enum
-
- { "pkg1/RegClass.Te$t_Enum.html",
- "<a name=\"Z:Z:DFLD2\">"
- },
- { "pkg1/RegClass.Te$t_Enum.html",
- "<a href=\"../pkg1/RegClass.Te$t_Enum.html#Z:Z:DFLD2\">"
- },
-
- //Test nested class
-
- { "pkg1/RegClass._NestedClas$.html",
- "<a name=\"Z:Z_NestedClas:D--\">"
- },
- { "pkg1/RegClass._NestedClas$.html",
- "<a href=\"../pkg1/RegClass._NestedClas$.html#Z:Z_NestedClas:D--\">"
- },
-
- //Test class use page
-
- { "pkg1/class-use/DeprMemClass.html",
- "<a href=\"../../pkg1/RegClass.html#d____mc\">"
- },
-
- //Test deprecated list page
-
- { "deprecated-list.html",
- "<a href=\"pkg1/DeprMemClass.html#Z:Z_field_In_Class\">"
- },
- { "deprecated-list.html",
- "<a href=\"pkg1/DeprMemClass.html#Z:Z:Dmethod_In_Class--\">"
- },
-
- //Test constant values page
-
- { "constant-values.html",
- "<a href=\"pkg1/RegClass.html#S_:D:D:D:D:DINT\">"
- },
-
- //Test serialized form page
-
- //This is the marker for the link that appears in the pkg1.RegClass.html page
- { "serialized-form.html",
- "<a name=\"pkg1.RegClass\">"
- },
-
- //Test member name index page
-
- { "index-all.html",
- "<a name=\"I:Z:Z:D\">"
- },
- { "index-all.html",
- "<a href=\"#I:Z:Z:D\">$"
- },
- { "index-all.html",
- "<a href=\"#I:Z:Z_\">_"
- }
};
- private static final String[][] NEGATED_TEST = {
- //The marker name conversion should only affect HTML anchors. It should not
- //affect the lables.
- { "pkg1/RegClass.html",
- " Z:Z_"
- },
- { "pkg1/RegClass.html",
- " Z:Z:Dfield"
- },
- { "pkg1/RegClass.html",
- " Z:Z_field_In_Class"
- },
- { "pkg1/RegClass.html",
- " S_:D:D:D:D:DINT"
- },
- };
-
- private static final String[] ARGS = new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "-use", "pkg1"
- };
-
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
public static void main(String[] args) throws Exception {
TestAnchorNames tester = new TestAnchorNames();
- tester.run(ARGS, TEST, NEGATED_TEST);
- tester.printSummary();
+ tester.runTests();
+ }
+
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ "-use",
+ "pkg1");
+ checkExit(Exit.OK);
+
+ // Test some section markers and links to these markers
+ checkOutput("pkg1/RegClass.html", true,
+ "<a name=\"skip.navbar.top\">",
+ "<a href=\"#skip.navbar.top\" title=\"Skip navigation links\">",
+ "<a name=\"nested.class.summary\">",
+ "<a href=\"#nested.class.summary\">",
+ "<a name=\"method.summary\">",
+ "<a href=\"#method.summary\">",
+ "<a name=\"field.detail\">",
+ "<a href=\"#field.detail\">",
+ "<a name=\"constructor.detail\">",
+ "<a href=\"#constructor.detail\">");
+
+ // Test some members and link to these members
+ checkOutput("pkg1/RegClass.html", true,
+ //The marker for this appears in the serialized-form.html which we will
+ //test below
+ "<a href=\"../serialized-form.html#pkg1.RegClass\">");
+
+ // Test some fields
+ checkOutput("pkg1/RegClass.html", true,
+ "<a name=\"Z:Z_\">",
+ "<a href=\"../pkg1/RegClass.html#Z:Z_\">",
+ "<a name=\"Z:Z_:D\">",
+ "<a href=\"../pkg1/RegClass.html#Z:Z_:D\">",
+ "<a name=\"Z:Z:D_\">",
+ "<a href=\"../pkg1/RegClass.html#Z:Z:D_\">",
+ "<a name=\"Z:Z:Dfield\">",
+ "<a href=\"../pkg1/RegClass.html#Z:Z:Dfield\">",
+ "<a name=\"fieldInCla:D:D\">",
+ "<a href=\"../pkg1/RegClass.html#fieldInCla:D:D\">",
+ "<a name=\"S_:D:D:D:D:DINT\">",
+ "<a href=\"../pkg1/RegClass.html#S_:D:D:D:D:DINT\">",
+ "<a name=\"method:D:D\">",
+ "<a href=\"../pkg1/RegClass.html#method:D:D\">");
+
+ checkOutput("pkg1/DeprMemClass.html", true,
+ "<a name=\"Z:Z_field_In_Class\">",
+ "<a href=\"../pkg1/DeprMemClass.html#Z:Z_field_In_Class\">");
+
+ // Test constructor
+ checkOutput("pkg1/RegClass.html", true,
+ "<a name=\"RegClass-java.lang.String-int-\">",
+ "<a href=\"../pkg1/RegClass.html#RegClass-java.lang.String-int-\">");
+
+ // Test some methods
+ checkOutput("pkg1/RegClass.html", true,
+ "<a name=\"Z:Z_methodInClass-java.lang.String-\">",
+ "<a href=\"../pkg1/RegClass.html#Z:Z_methodInClass-java.lang.String-\">",
+ "<a name=\"method--\">",
+ "<a href=\"../pkg1/RegClass.html#method--\">",
+ "<a name=\"foo-java.util.Map-\">",
+ "<a href=\"../pkg1/RegClass.html#foo-java.util.Map-\">",
+ "<a name=\"methodInCla:Ds-java.lang.String:A-\">",
+ "<a href=\"../pkg1/RegClass.html#methodInCla:Ds-java.lang.String:A-\">",
+ "<a name=\"Z:Z_methodInClas:D-java.lang.String-int-\">",
+ "<a href=\"../pkg1/RegClass.html#Z:Z_methodInClas:D-java.lang.String-int-\">",
+ "<a name=\"methodD-pkg1.RegClass.:DA-\">",
+ "<a href=\"../pkg1/RegClass.html#methodD-pkg1.RegClass.:DA-\">",
+ "<a name=\"methodD-pkg1.RegClass.D:A-\">",
+ "<a href=\"../pkg1/RegClass.html#methodD-pkg1.RegClass.D:A-\">");
+
+ checkOutput("pkg1/DeprMemClass.html", true,
+ "<a name=\"Z:Z:Dmethod_In_Class--\">",
+ "<a href=\"../pkg1/DeprMemClass.html#Z:Z:Dmethod_In_Class--\">");
+
+ // Test enum
+ checkOutput("pkg1/RegClass.Te$t_Enum.html", true,
+ "<a name=\"Z:Z:DFLD2\">",
+ "<a href=\"../pkg1/RegClass.Te$t_Enum.html#Z:Z:DFLD2\">");
+
+ // Test nested class
+ checkOutput("pkg1/RegClass._NestedClas$.html", true,
+ "<a name=\"Z:Z_NestedClas:D--\">",
+ "<a href=\"../pkg1/RegClass._NestedClas$.html#Z:Z_NestedClas:D--\">");
+
+ // Test class use page
+ checkOutput("pkg1/class-use/DeprMemClass.html", true,
+ "<a href=\"../../pkg1/RegClass.html#d____mc\">");
+
+ // Test deprecated list page
+ checkOutput("deprecated-list.html", true,
+ "<a href=\"pkg1/DeprMemClass.html#Z:Z_field_In_Class\">",
+ "<a href=\"pkg1/DeprMemClass.html#Z:Z:Dmethod_In_Class--\">");
+
+ // Test constant values page
+ checkOutput("constant-values.html", true,
+ "<a href=\"pkg1/RegClass.html#S_:D:D:D:D:DINT\">");
+
+ // Test serialized form page
+ checkOutput("serialized-form.html", true,
+ //This is the marker for the link that appears in the pkg1.RegClass.html page
+ "<a name=\"pkg1.RegClass\">");
+
+ // Test member name index page
+ checkOutput("index-all.html", true,
+ "<a name=\"I:Z:Z:D\">",
+ "<a href=\"#I:Z:Z:D\">$",
+ "<a href=\"#I:Z:Z_\">_");
+
+ // The marker name conversion should only affect HTML anchors. It should not
+ // affect the lables.
+ checkOutput("pkg1/RegClass.html", false,
+ " Z:Z_",
+ " Z:Z:Dfield",
+ " Z:Z_field_In_Class",
+ " S_:D:D:D:D:DINT");
}
}