Skip to content

Commit

Permalink
8202621: bad test with broken links needs to be updated
Browse files Browse the repository at this point in the history
Backport-of: 17773c3
  • Loading branch information
GoeLin committed Feb 17, 2023
1 parent bfd05a6 commit 98e3b0d
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 111 deletions.
12 changes: 4 additions & 8 deletions test/langtools/jdk/javadoc/doclet/DocRootSlash/DocRootSlash.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,12 @@ void test() {
// Directory that contains source files that javadoc runs on
String srcdir = System.getProperty("test.src", ".");

setAutomaticCheckLinks(false); // @ignore JDK-8202621

javadoc("-d", "out",
"-Xdoclint:none",
"-overview", (srcdir + "/overview.html"),
"--frames",
"-header", "<A HREF=\"{@docroot}/package-list\">{&#064;docroot}</A> <A HREF=\"{@docRoot}/help-doc\">{&#064;docRoot}</A>",
"-header", "<A HREF=\"{@docroot}/element-list\">{&#064;docroot}</A> <A HREF=\"{@docRoot}/help-doc.html\">{&#064;docRoot}</A>",
"-sourcepath", srcdir,
"p1", "p2");

Expand All @@ -69,8 +68,8 @@ void test() {
// Bug 4633447: Special test for overview-frame.html
// Find two strings in file "overview-frame.html"
checkOutput("overview-frame.html", true,
"<A HREF=\"./package-list\">",
"<A HREF=\"./help-doc\">");
"<A HREF=\"./element-list\">",
"<A HREF=\"./help-doc.html\">");
}

void checkFiles(String... filenameArray) {
Expand All @@ -81,7 +80,7 @@ void checkFiles(String... filenameArray) {
String fileString = readFile(f);
System.out.println("\nSub-tests for file: " + f + " --------------");
// Loop over all tests in a single file
for ( int j = 0; j < 11; j++ ) {
for ( int j = 0; j < 7; j++ ) {

// Compare actual to expected string for a single subtest
compareActualToExpected(++count, fileString);
Expand All @@ -107,9 +106,6 @@ void checkFiles(String... filenameArray) {
*/
private static final String prefix = "(?i)(<a\\s+href="; // <a href= (start group1)
private static final String ref1 = "\")([^\"]*)(\".*?>)"; // doublequotes (end group1, group2, group3)
private static final String ref2 = ")(\\S+?)([^<>]*>)"; // no quotes (end group1, group2, group3)
private static final String label = "(.*?)"; // text label (group4)
private static final String end = "(</a>)"; // </a> (group5)

/**
* Compares the actual string to the expected string in the specified string
Expand Down
52 changes: 15 additions & 37 deletions test/langtools/jdk/javadoc/doclet/DocRootSlash/overview.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,55 +9,33 @@

Case 0 Actual: <A HREF=".">.</A> &nbsp; Current directory
<p>
Sub-test 23 Actual: <A HREF="{@docroot}">{&#064;docroot}</A> Bare tag - ALL LOWERCASE <br>
Sub-test 23 Expect: <A HREF=""></A> <br>
(Expect empty string because lowercase docroot is illegal)
Sub-test 15 Actual: <A HREF="{@docroot}">{&#064;docroot}</A> Bare tag - ALL LOWERCASE <br>
Sub-test 15 Expect: <A HREF=""></A> <br>
(Expect empty string because lowercase docroot is illegal)
<p>

Sub-test 24 Actual: <A HREF="{@docRoot}">{&#064;docRoot}</A> Bare tag - "R" UPPERCASE <br>
Sub-test 24 Expect: <A HREF=".">.</A>
Sub-test 16 Actual: <A HREF="{@docRoot}">{&#064;docRoot}</A> Bare tag - "R" UPPERCASE <br>
Sub-test 16 Expect: <A HREF=".">.</A>
<p>

Sub-test 25 Actual: <A HREF="{@docRoot}/package-list">{&#064;docRoot}/package-list</A> <br>
Sub-test 25 Expect: <A HREF="./package-list">./package-list</A>
Sub-test 17 Actual: <A HREF="{@docRoot}/element-list">{&#064;docRoot}/element-list</A> <br>
Sub-test 17 Expect: <A HREF="./element-list">./element-list</A>
<p>

Sub-test 26 Actual: <A HREF="{@docRoot}/p2/C2.html">{&#064;docRoot}/p2/C2.html</A> <br>
Sub-test 26 Expect: <A HREF="./p2/C2.html">./p2/C2.html</A>
Sub-test 18 Actual: <A HREF="{@docRoot}/p2/C2.html">{&#064;docRoot}/p2/C2.html</A> <br>
Sub-test 18 Expect: <A HREF="./p2/C2.html">./p2/C2.html</A>
<p>

Sub-test 27 Actual: <A HREF="{@docRoot}/../docs1/p2/C2.html">{&#064;docRoot}/../docs1/p2/C2.html</A> <br>
Sub-test 27 Expect: <A HREF="./../docs1/p2/C2.html">./../docs1/p2/C2.html</A>
Sub-test 19 Actual: <A HREF="{@docRoot}/../out/p2/C2.html">{&#064;docRoot}/../out/p2/C2.html</A> <br>
Sub-test 19 Expect: <A HREF="./../out/p2/C2.html">./../out/p2/C2.html</A>
<p>

Sub-test 28 Actual: <A HREF="{@docRoot}/p2/package-summary.html#package_description">{&#064;docRoot}/p2/package-summary.html#package_description</A> <br>
Sub-test 28 Expect: <A HREF="./p2/package-summary.html#package_description">./p2/package-summary.html#package_description</A>
Sub-test 20 Actual: <A HREF="{@docRoot}/p2/package-summary.html#package.description">{&#064;docRoot}/p2/package-summary.html#package.description</A> <br>
Sub-test 20 Expect: <A HREF="./p2/package-summary.html#package.description">./p2/package-summary.html#package.description</A>
<p>

Sub-test 29 Actual: <A HREF="{@docRoot}/../docs1/p2/package-summary.html#package_description">{&#064;docRoot}/../docs1/p2/package-summary.html#package_description</A> <br>
Sub-test 29 Expect: <A HREF="./../docs1/p2/package-summary.html#package_description">./../docs1/p2/package-summary.html#package_description</A>
<p>

<!-- ============================================================== -->

Allow docRoot to work without a trailing slash for those who had to change their comments
to work with the 1.4.0 bug:
<p>

Sub-test 30 Actual: <A HREF="{@docRoot}p2/C2.html">{&#064;docRoot}p2/C2.html</A> <br>
Sub-test 30 Expect: <A HREF=".p2/C2.html">./p2/C2.html</A>
<p>

Sub-test 31 Actual: <A HREF="{@docRoot}../docs1/p2/C2.html">{&#064;docRoot}../docs1/p2/C2.html</A> <br>
Sub-test 31 Expect: <A HREF=".../docs1/p2/C2.html">./../docs1/p2/C2.html</A>
<p>

Sub-test 32 Actual: <A HREF="{@docRoot}p2/package-summary.html#package_description">{&#064;docRoot}/p2/package-summary.html#package_description</A> <br>
Sub-test 32 Expect: <A HREF=".p2/package-summary.html#package_description">./p2/package-summary.html#package_description</A>

<p>
Sub-test 33 Actual: <A HREF="{@docRoot}../docs1/p2/package-summary.html#package_description">{&#064;docRoot}/../docs1/p2/package-summary.html#package_description</A> <br>
Sub-test 33 Expect: <A HREF=".../docs1/p2/package-summary.html#package_description">./../docs1/p2/package-summary.html#package_description</A>
Sub-test 21 Actual: <A HREF="{@docRoot}/../out/p2/package-summary.html#package.description">{&#064;docRoot}/../out/p2/package-summary.html#package.description</A> <br>
Sub-test 21 Expect: <A HREF="./../out/p2/package-summary.html#package.description">./../out/p2/package-summary.html#package.description</A>

</BODY>
</HTML>
38 changes: 8 additions & 30 deletions test/langtools/jdk/javadoc/doclet/DocRootSlash/p1/C1.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,46 +39,24 @@
* Sub-test 2 Expect: <A HREF="..">..</A>
* <p>
*
* Sub-test 3 Actual: <A HREF="{@docRoot}/package-list">{&#064;docRoot}/package-list</A> <br>
* Sub-test 3 Expect: <A HREF="../package-list">../package-list</A>
* Sub-test 3 Actual: <A HREF="{@docRoot}/element-list">{&#064;docRoot}/element-list</A> <br>
* Sub-test 3 Expect: <A HREF="../element-list">../element-list</A>
* <p>
*
* Sub-test 4 Actual: <A HREF="{@docRoot}/p2/C2.html">{&#064;docRoot}/p2/C2.html</A> <br>
* Sub-test 4 Expect: <A HREF="../p2/C2.html">../p2/C2.html</A>
* <p>
*
* Sub-test 5 Actual: <A HREF="{@docRoot}/../docs1/p2/C2.html">{&#064;docRoot}/../docs1/p2/C2.html</A> <br>
* Sub-test 5 Expect: <A HREF="../../docs1/p2/C2.html">../../docs1/p2/C2.html</A>
* Sub-test 5 Actual: <A HREF="{@docRoot}/../out/p2/C2.html">{&#064;docRoot}/../out/p2/C2.html</A> <br>
* Sub-test 5 Expect: <A HREF="../../out/p2/C2.html">../../out/p2/C2.html</A>
* <p>
*
* Sub-test 6 Actual: <A HREF="{@docRoot}/p2/package-summary.html#package_description">{&#064;docRoot}/p2/package-summary.html#package_description</A> <br>
* Sub-test 6 Expect: <A HREF="../p2/package-summary.html#package_description">../p2/package-summary.html#package_description</A>
* Sub-test 6 Actual: <A HREF="{@docRoot}/p2/package-summary.html#package.description">{&#064;docRoot}/p2/package-summary.html#package.description</A> <br>
* Sub-test 6 Expect: <A HREF="../p2/package-summary.html#package.description">../p2/package-summary.html#package.description</A>
* <p>
*
* Sub-test 7 Actual: <A HREF="{@docRoot}/../docs1/p2/package-summary.html#package_description">{&#064;docRoot}/../docs1/p2/package-summary.html#package_description</A> <br>
* Sub-test 7 Expect: <A HREF="../../docs1/p2/package-summary.html#package_description">../../docs1/p2/package-summary.html#package_description</A>
* <p>
*
* <!-- =================================================================== -->
*
* Allow docRoot to work without a trailing slash for those who had to change their comments
* to work with the 1.4.0 bug:
* <p>
*
* Sub-test 8 Actual: <A HREF="{@docRoot}p2/C2.html">{&#064;docRoot}p2/C2.html</A> <br>
* Sub-test 8 Expect: <A HREF="..p2/C2.html">../p2/C2.html</A>
* <p>
*
* Sub-test 9 Actual: <A HREF="{@docRoot}../docs1/p2/C2.html">{&#064;docRoot}../docs1/p2/C2.html</A> <br>
* Sub-test 9 Expect: <A HREF="..../docs1/p2/C2.html">../../docs1/p2/C2.html</A>
* <p>
*
* Sub-test 10 Actual: <A HREF="{@docRoot}p2/package-summary.html#package_description">{&#064;docRoot}/p2/package-summary.html#package_description</A> <br>
* Sub-test 10 Expect: <A HREF="..p2/package-summary.html#package_description">../p2/package-summary.html#package_description#package_description</A>
* <p>
*
* Sub-test 11 Actual: <A HREF="{@docRoot}../docs1/p2/package-summary.html#package_description">{&#064;docRoot}/../docs1/p2/package-summary.html#package_description</A> <br>
* Sub-test 11 Expect: <A HREF="..../docs1/p2/package-summary.html#package_description">../../docs1/p2/package-summary.html#package_description</A>
* Sub-test 7 Actual: <A HREF="{@docRoot}/../out/p2/package-summary.html#package.description">{&#064;docRoot}/../out/p2/package-summary.html#package.description</A> <br>
* Sub-test 7 Expect: <A HREF="../../out/p2/package-summary.html#package.description">../../out/p2/package-summary.html#package.description</A>
*
*/
public class C1 {
Expand Down
50 changes: 14 additions & 36 deletions test/langtools/jdk/javadoc/doclet/DocRootSlash/p1/package.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,55 +10,33 @@
Case 0 Actual: <A HREF=".">.</A> &nbsp; Current directory
<p>

Sub-test 12 Actual: <A HREF="{@docroot}">{&#064;docroot}</A> Bare tag - ALL LOWERCASE <br>
Sub-test 12 Expect: <A HREF=""></A> <br>
Sub-test 8 Actual: <A HREF="{@docroot}">{&#064;docroot}</A> Bare tag - ALL LOWERCASE <br>
Sub-test 8 Expect: <A HREF=""></A> <br>
(Expect empty string because lowercase docroot is illegal)
<p>

Sub-test 13 Actual: <A HREF="{@docRoot}">{&#064;docRoot}</A> Bare tag - "R" UPPERCASE <br>
Sub-test 13 Expect: <A HREF="..">..</A>
Sub-test 9 Actual: <A HREF="{@docRoot}">{&#064;docRoot}</A> Bare tag - "R" UPPERCASE <br>
Sub-test 9 Expect: <A HREF="..">..</A>
<p>

Sub-test 14 Actual: <A HREF="{@docRoot}/package-list">{&#064;docRoot}/package-list</A> <br>
Sub-test 14 Expect: <A HREF="../package-list">../package-list</A>
Sub-test 10 Actual: <A HREF="{@docRoot}/element-list">{&#064;docRoot}/element-list</A> <br>
Sub-test 10 Expect: <A HREF="../element-list">../element-list</A>
<p>

Sub-test 15 Actual: <A HREF="{@docRoot}/p2/C2.html">{&#064;docRoot}/p2/C2.html</A> <br>
Sub-test 15 Expect: <A HREF="../p2/C2.html">../p2/C2.html</A>
Sub-test 11 Actual: <A HREF="{@docRoot}/p2/C2.html">{&#064;docRoot}/p2/C2.html</A> <br>
Sub-test 11 Expect: <A HREF="../p2/C2.html">../p2/C2.html</A>
<p>

Sub-test 16 Actual: <A HREF="{@docRoot}/../docs1/p2/C2.html">{&#064;docRoot}/../docs1/p2/C2.html</A> <br>
Sub-test 16 Expect: <A HREF="../../docs1/p2/C2.html">../../docs1/p2/C2.html</A>
Sub-test 12 Actual: <A HREF="{@docRoot}/../out/p2/C2.html">{&#064;docRoot}/../out/p2/C2.html</A> <br>
Sub-test 12 Expect: <A HREF="../../out/p2/C2.html">../../out/p2/C2.html</A>
<p>

Sub-test 17 Actual: <A HREF="{@docRoot}/p2/package-summary.html#package_description">{&#064;docRoot}/p2/package-summary.html#package_description</A> <br>
Sub-test 17 Expect: <A HREF="../p2/package-summary.html#package_description">../p2/package-summary.html#package_description</A>
Sub-test 13 Actual: <A HREF="{@docRoot}/p2/package-summary.html#package.description">{&#064;docRoot}/p2/package-summary.html#package.description</A> <br>
Sub-test 13 Expect: <A HREF="../p2/package-summary.html#package.description">../p2/package-summary.html#package.description</A>
<p>

Sub-test 18 Actual: <A HREF="{@docRoot}/../docs1/p2/package-summary.html#package_description">{&#064;docRoot}/../docs1/p2/package-summary.html#package_description</A> <br>
Sub-test 18 Expect: <A HREF="../../docs1/p2/package-summary.html#package_description">../../docs1/p2/package-summary.html#package_description</A>
<p>

<!-- ================================================================== -->

Allow docRoot to work without a trailing slash for those who had to change their comments
to work with the 1.4.0 bug:
<p>

Sub-test 19 Actual: <A HREF="{@docRoot}p2/C2.html">{&#064;docRoot}p2/C2.html</A> <br>
Sub-test 19 Expect: <A HREF="..p2/C2.html">../p2/C2.html</A>
<p>

Sub-test 20 Actual: <A HREF="{@docRoot}../docs1/p2/C2.html">{&#064;docRoot}../docs1/p2/C2.html</A> <br>
Sub-test 20 Expect: <A HREF="..../docs1/p2/C2.html">../../docs1/p2/C2.html</A>
<p>

Sub-test 21 Actual: <A HREF="{@docRoot}p2/package-summary.html#package_description">{&#064;docRoot}/p2/package-summary.html#package_description</A><br>
Sub-test 21 Expect: <A HREF="..p2/package-summary.html#package_description">../p2/package-summary.html#package_description</A>
<p>

Sub-test 22 Actual: <A HREF="{@docRoot}../docs1/p2/package-summary.html#package_description">{&#064;docRoot}/../docs1/p2/package-summary.html#package_description</A> <br>
Sub-test 22 Expect: <A HREF="..../docs1/p2/package-summary.html#package_description">../../docs1/p2/package-summary.html#package_description</A>
Sub-test 14 Actual: <A HREF="{@docRoot}/../out/p2/package-summary.html#package.description">{&#064;docRoot}/../out/p2/package-summary.html#package.description</A> <br>
Sub-test 14 Expect: <A HREF="../../out/p2/package-summary.html#package.description">../../out/p2/package-summary.html#package.description</A>

</BODY>
</HTML>

1 comment on commit 98e3b0d

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.