8038730: Clean up the way JavadocTester is invoked, and checks for errors

Reviewed-by: ksrini, sogoel, bpatel
This commit is contained in:
Jonathan Gibbons 2014-05-09 15:37:12 -07:00
parent 756eae6492
commit caa2209663
144 changed files with 7277 additions and 9513 deletions

View file

@ -25,23 +25,24 @@
* @test
* @bug 5093723
* @summary REGRESSION: ClassCastException in SingleIndexWriter
* @library ../lib/
* @library ../lib
* @build JavadocTester
* @build T5093723
* @run main T5093723
*/
public class T5093723 extends JavadocTester {
private static final String[] ARGS = new String[] {
"-d", OUTPUT_DIR + ".out", "-Xdoclint:none",
SRC_DIR + "/DocumentedClass.java",
SRC_DIR + "/UndocumentedClass.java"
};
public static void main(String... args) {
public static void main(String... args) throws Exception {
T5093723 tester = new T5093723();
if (tester.runJavadoc(ARGS) != 0)
throw new AssertionError("non-zero return code from javadoc");
tester.runTests();
}
@Test
void test() {
javadoc("-d", "out",
"-Xdoclint:none",
testSrc("DocumentedClass.java"),
testSrc("UndocumentedClass.java"));
checkExit(Exit.OK);
}
}

View file

@ -26,142 +26,31 @@
* @bug 4706779 4956908
* @summary Add text equivalent of class tree ASCII art for accessibility
* @author dkramer
* @library ../lib
* @build JavadocTester
* @run main AccessAsciiArt
*/
public class AccessAsciiArt extends JavadocTester {
import com.sun.javadoc.*;
import java.util.*;
import java.io.*;
/**
* Runs javadoc and runs regression tests on the resulting HTML.
* It reads each file, complete with newlines, into a string to easily
* find strings that contain newlines.
*/
public class AccessAsciiArt {
private static final String BUGID = "4706779-4956908";
private static final String BUGNAME = "AccessAsciiArt";
private static final String TMPDEST_DIR1 = "./docs1/";
private static final String TMPDEST_DIR2 = "./docs2/";
// Subtest number. Needed because runResultsOnHTML is run twice,
// and subtestNum should increment across subtest runs.
public static int subtestNum = 0;
public static int numSubtestsPassed = 0;
// Entry point
public static void main(String[] args) {
// Directory that contains source files that javadoc runs on
String srcdir = System.getProperty("test.src", ".");
// Test for all cases except the split index page
runJavadoc(new String[] {"-d", TMPDEST_DIR1,
"-sourcepath", srcdir,
"p1", "p1.subpkg"});
runTestsOnHTML(testArray);
printSummary();
public static void main(String... args) throws Exception {
AccessAsciiArt tester = new AccessAsciiArt();
tester.runTests();
}
/** Run javadoc */
public static void runJavadoc(String[] javadocArgs) {
if (com.sun.tools.javadoc.Main.execute(javadocArgs) != 0) {
throw new Error("Javadoc failed to execute");
}
}
/**
* Assign value for [ stringToFind, filename ]
* NOTE: The standard doclet uses the same separator "\n" for all OS's
*/
private static final String[][] testArray = {
@Test
void test() {
javadoc("-d", "out",
"-sourcepath", testSrc,
"p1", "p1.subpkg");
checkExit(Exit.OK);
checkOutput("p1/subpkg/SSC.html", true,
// Test the top line of the class tree
{
"<li><a href=\"../../p1/C.html\" title=\"class in p1\">p1.C</a></li>",
TMPDEST_DIR1 + "p1/subpkg/SSC.html" },
// Test the second line of the class tree
{
"<li><a href=\"../../p1/SC.html\" title=\"class in p1\">p1.SC</a></li>",
TMPDEST_DIR1 + "p1/subpkg/SSC.html" },
// Test the third line of the class tree
{
"<li>p1.subpkg.SSC</li>",
TMPDEST_DIR1 + "p1/subpkg/SSC.html" },
};
public static void runTestsOnHTML(String[][] testArray) {
for (int i = 0; i < testArray.length; i++) {
subtestNum += 1;
// Read contents of file into a string
String fileString = readFileToString(testArray[i][1]);
// Get string to find
String stringToFind = testArray[i][0];
// Find string in file's contents
if (findString(fileString, stringToFind) == -1) {
System.out.println("\nSub-test " + (subtestNum)
+ " for bug " + BUGID + " (" + BUGNAME + ") FAILED\n"
+ "when searching for:\n"
+ stringToFind);
} else {
numSubtestsPassed += 1;
System.out.println("\nSub-test " + (subtestNum) + " passed:\n" + stringToFind);
}
}
}
public static void printSummary() {
if ( numSubtestsPassed == subtestNum ) {
System.out.println("\nAll " + numSubtestsPassed + " subtests passed");
} else {
throw new Error("\n" + (subtestNum - numSubtestsPassed) + " of " + (subtestNum)
+ " subtests failed for bug " + BUGID + " (" + BUGNAME + ")\n");
}
}
// Read the file into a String
public static String readFileToString(String filename) {
try {
File file = new File(filename);
if ( !file.exists() ) {
System.out.println("\nFILE DOES NOT EXIST: " + filename);
}
BufferedReader in = new BufferedReader(new FileReader(file));
// Create an array of characters the size of the file
char[] allChars = new char[(int)file.length()];
// Read the characters into the allChars array
in.read(allChars, 0, (int)file.length());
in.close();
// Convert to a string
String allCharsString = new String(allChars);
return allCharsString;
} catch (FileNotFoundException e) {
System.err.println(e);
return "";
} catch (IOException e) {
System.err.println(e);
return "";
}
}
public static int findString(String fileString, String stringToFind) {
return fileString.indexOf(stringToFind);
"<li>p1.subpkg.SSC</li>");
}
}

View file

@ -26,141 +26,32 @@
* @bug 4636655
* @summary Add title attribute to <FRAME> tags for accessibility
* @author dkramer
* @library ../lib
* @build JavadocTester
* @run main AccessFrameTitle
*/
public class AccessFrameTitle extends JavadocTester {
import com.sun.javadoc.*;
import java.util.*;
import java.io.*;
/**
* Runs javadoc and runs regression tests on the resulting HTML.
* It reads each file, complete with newlines, into a string to easily
* find strings that contain newlines.
*/
public class AccessFrameTitle {
private static final String BUGID = "4636655";
private static final String BUGNAME = "AccessFrameTitle";
private static final String TMPDEST_DIR1 = "./docs1/";
private static final String TMPDEST_DIR2 = "./docs2/";
// Subtest number. Needed because runResultsOnHTML is run twice,
// and subtestNum should increment across subtest runs.
public static int subtestNum = 0;
public static int numSubtestsPassed = 0;
// Entry point
public static void main(String[] args) {
// Directory that contains source files that javadoc runs on
String srcdir = System.getProperty("test.src", ".");
// Test for all cases except the split index page
runJavadoc(new String[] {"-d", TMPDEST_DIR1,
"-sourcepath", srcdir,
"p1", "p2"});
runTestsOnHTML(testArray);
printSummary();
public static void main(String... args) throws Exception {
AccessFrameTitle tester = new AccessFrameTitle();
tester.runTests();
}
/** Run javadoc */
public static void runJavadoc(String[] javadocArgs) {
if (com.sun.tools.javadoc.Main.execute(javadocArgs) != 0) {
throw new Error("Javadoc failed to execute");
}
}
/**
* Assign value for [ stringToFind, filename ]
* NOTE: The standard doclet uses the same separator "\n" for all OS's
*/
private static final String[][] testArray = {
@Test
void test() {
javadoc("-d", "out",
"-sourcepath", testSrc,
"p1", "p2");
checkExit(Exit.OK);
// Testing only for the presence of the title attributes.
// To make this test more robust, only
// the initial part of each title string is tested for,
// in case the ending part of the string later changes
{ "title=\"All classes and interfaces (except non-static nested types)\"",
TMPDEST_DIR1 + "index.html" },
{ "title=\"All Packages\"",
TMPDEST_DIR1 + "index.html" },
{ "title=\"Package, class and interface descriptions\"",
TMPDEST_DIR1 + "index.html" },
};
public static void runTestsOnHTML(String[][] testArray) {
for (int i = 0; i < testArray.length; i++) {
subtestNum += 1;
// Read contents of file into a string
String fileString = readFileToString(testArray[i][1]);
// Get string to find
String stringToFind = testArray[i][0];
// Find string in file's contents
if (findString(fileString, stringToFind) == -1) {
System.out.println("\nSub-test " + (subtestNum)
+ " for bug " + BUGID + " (" + BUGNAME + ") FAILED\n"
+ "when searching for:\n"
+ stringToFind);
} else {
numSubtestsPassed += 1;
System.out.println("\nSub-test " + (subtestNum) + " passed:\n" + stringToFind);
}
}
}
public static void printSummary() {
if ( numSubtestsPassed == subtestNum ) {
System.out.println("\nAll " + numSubtestsPassed + " subtests passed");
} else {
throw new Error("\n" + (subtestNum - numSubtestsPassed) + " of " + (subtestNum)
+ " subtests failed for bug " + BUGID + " (" + BUGNAME + ")\n");
}
}
// Read the file into a String
public static String readFileToString(String filename) {
try {
File file = new File(filename);
if ( !file.exists() ) {
System.out.println("\nFILE DOES NOT EXIST: " + filename);
}
BufferedReader in = new BufferedReader(new FileReader(file));
// Create an array of characters the size of the file
char[] allChars = new char[(int)file.length()];
// Read the characters into the allChars array
in.read(allChars, 0, (int)file.length());
in.close();
// Convert to a string
String allCharsString = new String(allChars);
return allCharsString;
} catch (FileNotFoundException e) {
System.err.println(e);
return "";
} catch (IOException e) {
System.err.println(e);
return "";
}
}
public static int findString(String fileString, String stringToFind) {
return fileString.indexOf(stringToFind);
checkOutput("index.html", true,
"title=\"All classes and interfaces (except non-static nested types)\"",
"title=\"All Packages\"",
"title=\"Package, class and interface descriptions\"");
}
}

View file

@ -26,141 +26,35 @@
* @bug 4636667 7052425 8016549
* @summary Use <H1, <H2>, and <H3> in proper sequence for accessibility
* @author dkramer
* @library ../lib
* @build JavadocTester
* @run main AccessH1
*/
import com.sun.javadoc.*;
import java.util.*;
import java.io.*;
public class AccessH1 extends JavadocTester {
public static void main(String... args) throws Exception {
AccessH1 tester = new AccessH1();
tester.runTests();
}
/**
* Runs javadoc and runs regression tests on the resulting HTML.
* It reads each file, complete with newlines, into a string to easily
* find strings that contain newlines.
*/
public class AccessH1 {
protected static final String NL = System.getProperty("line.separator");
private static final String BUGID = "4636667-7052425";
private static final String BUGNAME = "AccessH1";
private static final String TMPDEST_DIR1 = "./docs1/";
private static final String TMPDEST_DIR2 = "./docs2/";
// Subtest number. Needed because runResultsOnHTML is run twice,
// and subtestNum should increment across subtest runs.
public static int subtestNum = 0;
public static int numSubtestsPassed = 0;
// Entry point
public static void main(String[] args) {
// Directory that contains source files that javadoc runs on
String srcdir = System.getProperty("test.src", ".");
// Test for all cases except the split index page
runJavadoc(new String[] {"-d", TMPDEST_DIR1,
@Test
void test() {
javadoc("-d", "out",
"-doctitle", "Document Title",
"-sourcepath", srcdir,
"p1", "p2"});
runTestsOnHTML(testArray);
"-sourcepath", testSrc,
"p1", "p2");
checkExit(Exit.OK);
printSummary();
}
/** Run javadoc */
public static void runJavadoc(String[] javadocArgs) {
if (com.sun.tools.javadoc.Main.execute(javadocArgs) != 0) {
throw new Error("Javadoc failed to execute");
}
}
/**
* Assign value for [ stringToFind, filename ]
* NOTE: The standard doclet uses the same separator "\n" for all OS's
*/
private static final String[][] testArray = {
// Test the style sheet
{
"h1 {\n" +
" font-size:20px;\n" +
"}",
TMPDEST_DIR1 + "stylesheet.css"
},
checkOutput("stylesheet.css", true,
"h1 {\n"
+ " font-size:20px;\n"
+ "}");
// Test the doc title in the overview page
{
"<h1 class=\"title\">Document Title</h1>",
TMPDEST_DIR1 + "overview-summary.html"
}
};
public static void runTestsOnHTML(String[][] testArray) {
for (int i = 0; i < testArray.length; i++) {
subtestNum += 1;
// Read contents of file into a string
String fileString = readFileToString(testArray[i][1]);
// Get string to find
String stringToFind = testArray[i][0];
// Find string in file's contents
if (findString(fileString, stringToFind) == -1) {
System.out.println("\nSub-test " + (subtestNum)
+ " for bug " + BUGID + " (" + BUGNAME + ") FAILED\n"
+ "when searching for:\n"
+ stringToFind);
} else {
numSubtestsPassed += 1;
System.out.println("\nSub-test " + (subtestNum) + " passed:\n" + stringToFind);
}
}
}
public static void printSummary() {
if ( numSubtestsPassed == subtestNum ) {
System.out.println("\nAll " + numSubtestsPassed + " subtests passed");
} else {
throw new Error("\n" + (subtestNum - numSubtestsPassed) + " of " + (subtestNum)
+ " subtests failed for bug " + BUGID + " (" + BUGNAME + ")\n");
}
}
// Read the file into a String
public static String readFileToString(String filename) {
try {
File file = new File(filename);
if ( !file.exists() ) {
System.out.println("\nFILE DOES NOT EXIST: " + filename);
}
BufferedReader in = new BufferedReader(new FileReader(file));
// Create an array of characters the size of the file
char[] allChars = new char[(int)file.length()];
// Read the characters into the allChars array
in.read(allChars, 0, (int)file.length());
in.close();
// Convert to a string
String allCharsString = new String(allChars);
return allCharsString;
} catch (FileNotFoundException e) {
System.err.println(e);
return "";
} catch (IOException e) {
System.err.println(e);
return "";
}
}
public static int findString(String fileString, String stringToFind) {
return fileString.replace(NL, "\n").indexOf(stringToFind);
checkOutput("overview-summary.html", true,
"<h1 class=\"title\">Document Title</h1>");
}
}

View file

@ -26,150 +26,40 @@
* @bug 4638136 7198273 8025633
* @summary Add ability to skip over nav bar for accessibility
* @author dkramer
* @library ../lib
* @build JavadocTester
* @run main AccessSkipNav
*/
public class AccessSkipNav extends JavadocTester {
import com.sun.javadoc.*;
import java.util.*;
import java.io.*;
/**
* Runs javadoc and runs regression tests on the resulting HTML.
* It reads each file, complete with newlines, into a string to easily
* find strings that contain newlines.
*/
public class AccessSkipNav {
protected static final String NL = System.getProperty("line.separator");
private static final String BUGID = "4638136 - 7198273";
private static final String BUGNAME = "AccessSkipNav";
private static final String TMPDEST_DIR1 = "./docs1/";
private static final String TMPDEST_DIR2 = "./docs2/";
// Subtest number. Needed because runResultsOnHTML is run twice,
// and subtestNum should increment across subtest runs.
public static int subtestNum = 0;
public static int numSubtestsPassed = 0;
// Entry point
public static void main(String[] args) {
// Directory that contains source files that javadoc runs on
String srcdir = System.getProperty("test.src", ".");
// Test for all cases except the split index page
runJavadoc(new String[] {"-d", TMPDEST_DIR1,
"-sourcepath", srcdir,
"p1", "p2"});
runTestsOnHTML(testArray);
printSummary();
public static void main(String... args) throws Exception {
AccessSkipNav tester = new AccessSkipNav();
tester.runTests();
}
/** Run javadoc */
public static void runJavadoc(String[] javadocArgs) {
if (com.sun.tools.javadoc.Main.execute(javadocArgs) != 0) {
throw new Error("Javadoc failed to execute");
}
}
/**
* Assign value for [ stringToFind, filename ]
* NOTE: The standard doclet uses the same separator "\n" for all OS's
*/
private static final String[][] testArray = {
@Test
void test() {
javadoc("-d", "out",
"-sourcepath", testSrc,
"p1", "p2");
checkExit(Exit.OK);
// Testing only for the presence of the <a href> and <a name>
checkOutput("p1/C1.html", true,
// Top navbar <a href>
{ "<a href=\"#skip.navbar.top\" title=\"Skip navigation links\">Skip navigation links</a>",
TMPDEST_DIR1 + "p1/C1.html" },
"<a href=\"#skip.navbar.top\" title=\"Skip navigation links\">Skip navigation links</a>",
// Top navbar <a name>
{ "<a name=\"skip.navbar.top\">\n" +
"<!-- -->\n" +
"</a>",
TMPDEST_DIR1 + "p1/C1.html" },
"<a name=\"skip.navbar.top\">\n"
+ "<!-- -->\n"
+ "</a>",
// Bottom navbar <a href>
{ "<a href=\"#skip.navbar.bottom\" title=\"Skip navigation links\">Skip navigation links</a>",
TMPDEST_DIR1 + "p1/C1.html" },
"<a href=\"#skip.navbar.bottom\" title=\"Skip navigation links\">Skip navigation links</a>",
// Bottom navbar <a name>
{ "<a name=\"skip.navbar.bottom\">\n" +
"<!-- -->\n" +
"</a>",
TMPDEST_DIR1 + "p1/C1.html" }
};
"<a name=\"skip.navbar.bottom\">\n"
+ "<!-- -->\n"
+ "</a>");
public static void runTestsOnHTML(String[][] testArray) {
for (int i = 0; i < testArray.length; i++) {
subtestNum += 1;
// Read contents of file into a string
String fileString = readFileToString(testArray[i][1]);
// Get string to find
String stringToFind = testArray[i][0];
// Find string in file's contents
if (findString(fileString, stringToFind) == -1) {
System.out.println("\nSub-test " + (subtestNum)
+ " for bug " + BUGID + " (" + BUGNAME + ") FAILED\n"
+ "when searching for:\n"
+ stringToFind);
} else {
numSubtestsPassed += 1;
System.out.println("\nSub-test " + (subtestNum) + " passed:\n" + stringToFind);
}
}
}
public static void printSummary() {
if ( numSubtestsPassed == subtestNum ) {
System.out.println("\nAll " + numSubtestsPassed + " subtests passed");
} else {
throw new Error("\n" + (subtestNum - numSubtestsPassed) + " of " + (subtestNum)
+ " subtests failed for bug " + BUGID + " (" + BUGNAME + ")\n");
}
}
// Read the file into a String
public static String readFileToString(String filename) {
try {
File file = new File(filename);
if ( !file.exists() ) {
System.out.println("\nFILE DOES NOT EXIST: " + filename);
}
BufferedReader in = new BufferedReader(new FileReader(file));
// Create an array of characters the size of the file
char[] allChars = new char[(int)file.length()];
// Read the characters into the allChars array
in.read(allChars, 0, (int)file.length());
in.close();
// Convert to a string
String allCharsString = new String(allChars);
return allCharsString;
} catch (FileNotFoundException e) {
System.err.println(e);
return "";
} catch (IOException e) {
System.err.println(e);
return "";
}
}
public static int findString(String fileString, String stringToFind) {
return fileString.replace(NL, "\n").indexOf(stringToFind);
}
}

View file

@ -26,45 +26,35 @@
* @bug 4637604 4775148
* @summary Test the tables for summary attribute
* @author dkramer
* @library ../lib/
* @library ../lib
* @build JavadocTester
* @build AccessSummary
* @run main AccessSummary
*/
public class AccessSummary extends JavadocTester {
/**
* Assign value for [ fileToSearch, stringToFind ]
*/
private static final String[][] TESTARRAY1 = {
// Test that the summary attribute appears
{ "overview-summary.html",
"summary=\"Packages table, listing packages, and an explanation\"" },
// Test that the summary attribute appears
{ "p1/C1.html",
"summary=\"Constructor Summary table, listing constructors, and an explanation\"" },
// Test that the summary attribute appears
{ "constant-values.html",
"summary=\"Constant Field Values table, listing constant fields, and values\"" }
};
// First test with -header only
private static final String[] JAVADOC_ARGS = new String[] {
"-d", OUTPUT_DIR,
"-sourcepath", SRC_DIR,
"p1", "p2"};
/**
* The entry point of the test.
* @param args the array of command line arguments.
* @throws Exception if the test fails
*/
public static void main(String[] args) {
JavadocTester tester = new AccessSummary();
tester.run(JAVADOC_ARGS, TESTARRAY1, new String[][] {});
tester.printSummary(); // Necessary for string search
public static void main(String... args) throws Exception {
AccessSummary tester = new AccessSummary();
tester.runTests();
}
@Test
void testAccessSummary() {
javadoc("-d", "out", "-sourcepath", testSrc, "p1", "p2");
checkExit(Exit.OK);
checkOutput("overview-summary.html", true,
"summary=\"Packages table, listing packages, and an explanation\"");
// Test that the summary attribute appears
checkOutput("p1/C1.html", true,
"summary=\"Constructor Summary table, listing constructors, and an explanation\"");
// Test that the summary attribute appears
checkOutput("constant-values.html", true,
"summary=\"Constant Field Values table, listing constant fields, and values\"");
}
}

View file

@ -26,143 +26,37 @@
* @bug 4651598 8026567
* @summary Javadoc wrongly inserts </DD> tags when using multiple @author tags
* @author dkramer
* @library ../lib
* @build JavadocTester
* @run main AuthorDD
*/
import com.sun.javadoc.*;
import java.util.*;
import java.io.*;
/**
* Runs javadoc and runs regression tests on the resulting HTML.
* It reads each file, complete with newlines, into a string to easily
* find strings that contain newlines.
*/
public class AuthorDD
{
public class AuthorDD extends JavadocTester {
protected static final String NL = System.getProperty("line.separator");
private static final String BUGID = "4651598";
private static final String BUGNAME = "AuthorDD";
// Subtest number. Needed because runResultsOnHTML is run twice, and subtestNum
// should increment across subtest runs.
public static int subtestNum = 0;
public static int numSubtestsPassed = 0;
// Entry point
public static void main(String[] args) {
// Directory that contains source files that javadoc runs on
String srcdir = System.getProperty("test.src", ".");
public static void main(String... args) throws Exception {
AuthorDD tester = new AuthorDD();
tester.runTests();
}
@Test
void test() {
// Test for all cases except the split index page
runJavadoc(new String[] {"-d", BUGID,
javadoc("-d", "out",
"-author",
"-version",
"-sourcepath", srcdir,
"p1"});
runTestsOnHTML(testArray);
printSummary();
}
/** Run javadoc */
public static void runJavadoc(String[] javadocArgs) {
if (com.sun.tools.javadoc.Main.execute(AuthorDD.class.getClassLoader(),
javadocArgs) != 0) {
throw new Error("Javadoc failed to execute");
}
}
/**
* Assign value for [ stringToFind, filename ]
* NOTE: The standard doclet uses the same separator "\n" for all OS's
*/
private static final String[][] testArray = {
"-sourcepath", testSrc,
"p1");
checkExit(Exit.OK);
checkOutput("p1/C1.html", true,
// Test single @since tag:
{ "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n" +
"<dd>JDK 1.0</dd>",
BUGID + "/p1/C1.html" },
"<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n"
+ "<dd>JDK 1.0</dd>",
// Test multiple @author tags:
{ "<dt><span class=\"simpleTagLabel\">Author:</span></dt>\n" +
"<dd>Doug Kramer, Jamie, Neal</dd>",
BUGID + "/p1/C1.html" },
};
public static void runTestsOnHTML(String[][] testArray) {
for (int i = 0; i < testArray.length; i++) {
subtestNum += 1;
// Read contents of file into a string
String fileString = readFileToString(testArray[i][1]);
// Get string to find
String stringToFind = testArray[i][0];
// Find string in file's contents
if (findString(fileString, stringToFind) == -1) {
System.out.println("\nSub-test " + (subtestNum)
+ " for bug " + BUGID + " (" + BUGNAME + ") FAILED\n"
+ "when searching for:\n"
+ stringToFind);
} else {
numSubtestsPassed += 1;
System.out.println("\nSub-test " + (subtestNum) + " passed:\n" + stringToFind);
}
}
}
public static void printSummary() {
if ( numSubtestsPassed == subtestNum ) {
System.out.println("\nAll " + numSubtestsPassed + " subtests passed");
} else {
throw new Error("\n" + (subtestNum - numSubtestsPassed) + " of " + (subtestNum)
+ " subtests failed for bug " + BUGID + " (" + BUGNAME + ")\n");
}
}
// Read the file into a String
public static String readFileToString(String filename) {
try {
File file = new File(filename);
if ( !file.exists() ) {
System.out.println("\nFILE DOES NOT EXIST: " + filename);
}
BufferedReader in = new BufferedReader(new FileReader(file));
// Create an array of characters the size of the file
char[] allChars = new char[(int)file.length()];
// Read the characters into the allChars array
in.read(allChars, 0, (int)file.length());
in.close();
// Convert to a string
String allCharsString = new String(allChars);
return allCharsString;
} catch (FileNotFoundException e) {
System.err.println(e);
return "";
} catch (IOException e) {
System.err.println(e);
return "";
}
}
public static int findString(String fileString, String stringToFind) {
return fileString.replace(NL, "\n").indexOf(stringToFind);
"<dt><span class=\"simpleTagLabel\">Author:</span></dt>\n"
+ "<dd>Doug Kramer, Jamie, Neal</dd>");
}
}

View file

@ -26,13 +26,11 @@
* @bug 4524350 4662945 4633447
* @summary stddoclet: {@docRoot} inserts an extra trailing "/"
* @author dkramer
* @library ../lib
* @build JavadocTester
* @run main DocRootSlash
*/
import com.sun.javadoc.*;
import java.util.*;
import java.io.*;
import java.nio.*;
import java.util.regex.*;
/**
@ -40,149 +38,55 @@ import java.util.regex.*;
* It reads each file, complete with newlines, into a string to easily
* find strings that contain newlines.
*/
public class DocRootSlash
{
private static final String BUGID = "4524350, 4662945, or 4633447";
private static final String BUGNAME = "DocRootSlash";
private static final String TMPDIR_STRING1 = "./docs1/";
public class DocRootSlash extends JavadocTester {
// Test number. Needed because runResultsOnHTMLFile is run twice, and subtestNum
// should increment across test runs.
public static int subtestNum = 0;
public static int numOfSubtestsPassed = 0;
// Entry point
public static void main(String[] args) {
public static void main(String... args) throws Exception {
DocRootSlash tester = new DocRootSlash();
tester.runTests();
}
@Test
void test() {
// Directory that contains source files that javadoc runs on
String srcdir = System.getProperty("test.src", ".");
runJavadoc(new String[] {"-d", TMPDIR_STRING1,
javadoc("-d", "out",
"-Xdoclint:none",
"-overview", (srcdir + "/overview.html"),
"-header", "<A HREF=\"{@docroot}/package-list\">{&#064;docroot}</A> <A HREF=\"{@docRoot}/help-doc\">{&#064;docRoot}</A>",
"-sourcepath", srcdir,
"p1", "p2"});
runTestsOnHTMLFiles(filenameArray);
"p1", "p2");
printSummary();
}
/** Run javadoc */
public static void runJavadoc(String[] javadocArgs) {
if (com.sun.tools.javadoc.Main.execute(javadocArgs) != 0) {
throw new Error("Javadoc failed to execute");
}
}
/** The array of filenames to test */
private static final String[] filenameArray = {
TMPDIR_STRING1 + "p1/C1.html" ,
TMPDIR_STRING1 + "p1/package-summary.html",
TMPDIR_STRING1 + "overview-summary.html"
};
public static void runTestsOnHTMLFiles(String[] filenameArray) {
String fileString;
// Bugs 4524350 4662945
for (int i = 0; i < filenameArray.length; i++ ) {
// Read contents of file (whose filename is in filenames) into a string
fileString = readFileToString(filenameArray[i]);
System.out.println("\nSub-tests for file: " + filenameArray[i]
+ " --------------");
// Loop over all tests in a single file
for ( int j = 0; j < 11; j++ ) {
subtestNum += 1;
// Compare actual to expected string for a single subtest
compareActualToExpected(fileString);
}
}
checkFiles(
"p1/C1.html" ,
"p1/package-summary.html",
"overview-summary.html");
// Bug 4633447: Special test for overview-frame.html
// Find two strings in file "overview-frame.html"
String filename = TMPDIR_STRING1 + "overview-frame.html";
fileString = readFileToString(filename);
// Find first string <A HREF="./package-list"> in overview-frame.html
subtestNum += 1;
String stringToFind = "<A HREF=\"./package-list\">";
String result;
if ( fileString.indexOf(stringToFind) == -1 ) {
result = "FAILED";
} else {
result = "succeeded";
numOfSubtestsPassed += 1;
}
System.out.println("\nSub-test " + (subtestNum)
+ " for bug " + BUGID + " (" + BUGNAME + ") " + result + "\n"
+ "when searching for:\n"
+ stringToFind + "\n"
+ "in file " + filename);
// Find second string <A HREF="./help-doc"> in overview-frame.html
subtestNum += 1;
stringToFind = "<A HREF=\"./help-doc\">";
if ( fileString.indexOf(stringToFind) == -1 ) {
result = "FAILED";
} else {
result = "succeeded";
numOfSubtestsPassed += 1;
}
System.out.println("\nSub-test " + (subtestNum)
+ " for bug " + BUGID + " (" + BUGNAME + ") " + result + "\n"
+ "when searching for:\n"
+ stringToFind + "\n"
+ "in file " + filename);
checkOutput("overview-frame.html", true,
"<A HREF=\"./package-list\">",
"<A HREF=\"./help-doc\">");
}
public static void printSummary() {
System.out.println("");
if ( numOfSubtestsPassed == subtestNum ) {
System.out.println("\nAll " + numOfSubtestsPassed + " subtests passed");
} else {
throw new Error("\n" + (subtestNum - numOfSubtestsPassed) + " of " + (subtestNum)
+ " subtests failed for bug " + BUGID + " (" + BUGNAME + ")\n");
void checkFiles(String... filenameArray) {
int count = 0;
for (String f : filenameArray) {
// Read contents of file into a string
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++ ) {
// Compare actual to expected string for a single subtest
compareActualToExpected(++count, fileString);
}
}
// Read the contents of the file into a String
public static String readFileToString(String filename) {
try {
File file = new File(filename);
if ( !file.exists() ) {
System.out.println("\nFILE DOES NOT EXIST: " + filename);
}
BufferedReader in = new BufferedReader(new FileReader(file));
// Create an array of characters the size of the file
char[] allChars = new char[(int)file.length()];
// Read the characters into the allChars array
in.read(allChars, 0, (int)file.length());
in.close();
// Convert to a string
String allCharsString = new String(allChars);
return allCharsString;
} catch (FileNotFoundException e) {
System.err.println(e);
return "";
} catch (IOException e) {
System.err.println(e);
return "";
}
}
/**
* Regular expression pattern matching code adapted from Eric's
* /java/pubs/dev/linkfix/src/LinkFix.java
* Regular expression pattern matching code
*
* Prefix Pattern:
* flag (?i) (case insensitive, so "a href" == "A HREF" and all combinations)
@ -197,34 +101,33 @@ public class DocRootSlash
* group4 (.*?) (label - zero or more characters)
* group5 (</a>) (end tag)
*/
static String prefix = "(?i)(<a\\s+href="; // <a href= (start group1)
static String ref1 = "\")([^\"]*)(\".*?>)"; // doublequotes (end group1, group2, group3)
static String ref2 = ")(\\S+?)([^<>]*>)"; // no quotes (end group1, group2, group3)
static String label = "(.*?)"; // text label (group4)
static String end = "(</a>)"; // </a> (group5)
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
* str String to search through
* @param str String to search through
*/
static void compareActualToExpected(String str) {
// Pattern must be compiled each run because subtestNum is incremented
void compareActualToExpected(int count, String str) {
checking("comparison for " + str);
// Pattern must be compiled each run because numTestsRun is incremented
Pattern actualLinkPattern1 =
Pattern.compile("Sub-test " + subtestNum + " Actual: " + prefix + ref1, Pattern.DOTALL);
Pattern.compile("Sub-test " + count + " Actual: " + prefix + ref1, Pattern.DOTALL);
Pattern expectLinkPattern1 =
Pattern.compile("Sub-test " + subtestNum + " Expect: " + prefix + ref1, Pattern.DOTALL);
Pattern.compile("Sub-test " + count + " Expect: " + prefix + ref1, Pattern.DOTALL);
// Pattern linkPattern2 = Pattern.compile(prefix + ref2 + label + end, Pattern.DOTALL);
CharBuffer charBuffer = CharBuffer.wrap(str);
Matcher actualLinkMatcher1 = actualLinkPattern1.matcher(charBuffer);
Matcher expectLinkMatcher1 = expectLinkPattern1.matcher(charBuffer);
String result;
Matcher actualLinkMatcher1 = actualLinkPattern1.matcher(str);
Matcher expectLinkMatcher1 = expectLinkPattern1.matcher(str);
if (expectLinkMatcher1.find() && actualLinkMatcher1.find()) {
String expectRef = expectLinkMatcher1.group(2);
String actualRef = actualLinkMatcher1.group(2);
if (actualRef.equals(expectRef)) {
result = "succeeded";
numOfSubtestsPassed += 1;
passed(expectRef);
// System.out.println("pattern: " + actualLinkPattern1.pattern());
// System.out.println("actualRef: " + actualRef);
// System.out.println("group0: " + actualLinkMatcher1.group());
@ -233,14 +136,12 @@ public class DocRootSlash
// System.out.println("group3: " + actualLinkMatcher1.group(3));
// System.exit(0);
} else {
result = "FAILED";
}
System.out.println("\nSub-test " + (subtestNum)
+ " for bug " + BUGID + " (" + BUGNAME + ") " + result + "\n"
+ "Actual: \"" + actualRef + "\"" + "\n"
failed("\n"
+ "Actual: \"" + actualRef + "\"\n"
+ "Expect: \"" + expectRef + "\"");
}
} else {
System.out.println("Didn't find <A HREF> that fits the pattern: "
failed("Didn't find <A HREF> that fits the pattern: "
+ expectLinkPattern1.pattern());
}
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,11 +26,11 @@
* @bug 8008768
* @summary Using {@inheritDoc} in simple tag defined via -tag fails
* @author Mike Duigou
* @library ../lib
* @build JavadocTester
* @run main DocTest
*/
import java.io.*;
/**
* DocTest documentation.
*
@ -38,41 +38,27 @@ import java.io.*;
* @implSpec DocTest implementation spec.
* @implNote DocTest implementation note.
*/
public class DocTest {
public class DocTest extends JavadocTester {
public static void main(String... args) throws Exception {
String[] javadoc_args = {
"-verbose",
DocTest tester = new DocTest();
tester.runTests();
}
@Test
void test() {
javadoc("-verbose",
"-d", "DocTest",
"-tag", "apiNote:optcm:<em>API Note</em>",
"-tag", "implSpec:optcm:<em>Implementation Requirements</em>:",
"-tag", "implNote:optcm:<em>Implementation Note</em>:",
"-package",
new File(System.getProperty("test.src"), "DocTest.java").getPath()
};
testSrc("DocTest.java")
);
checkExit(Exit.OK);
// javadoc does not report an exit code for an internal exception (!)
// so monitor stderr for stack dumps.
PrintStream prevErr = System.err;
ByteArrayOutputStream err_baos = new ByteArrayOutputStream();
PrintStream err_ps = new PrintStream(err_baos);
System.setErr(err_ps);
int rc;
try {
rc = com.sun.tools.javadoc.Main.execute(javadoc_args);
} finally {
err_ps.close();
System.setErr(prevErr);
}
String err = err_baos.toString();
System.err.println(err);
if (rc != 0)
throw new Exception("javadoc exited with rc=" + rc);
if (err.contains("at com.sun."))
throw new Exception("javadoc output contains stack trace");
checkOutput(Output.STDERR, false, "at com.sun");
}
/**

View file

@ -27,172 +27,49 @@
* @summary Javascript IE load error when linked by -linkoffline
* Window title shouldn't change when loading left frames (javascript)
* @author dkramer
* @library ../lib
* @build JavadocTester
* @run main JavascriptWinTitle
*/
public class JavascriptWinTitle extends JavadocTester {
import com.sun.javadoc.*;
import java.util.*;
import java.io.*;
public static void main(String... args) throws Exception {
JavascriptWinTitle tester = new JavascriptWinTitle();
tester.runTests();
}
/**
* Runs javadoc and runs regression tests on the resulting HTML.
* It reads each file, complete with newlines, into a string to easily
* find strings that contain newlines.
*/
public class JavascriptWinTitle {
protected static final String NL = System.getProperty("line.separator");
private static final String BUGID = "4645058";
private static final String BUGNAME = "JavascriptWinTitle";
private static final String TMPDEST_DIR1 = "./docs1/";
private static final String TMPDEST_DIR2 = "./docs2/";
// Subtest number. Needed because runResultsOnHTML is run twice,
// and subtestNum should increment across subtest runs.
public static int subtestNum = 0;
public static int numSubtestsPassed = 0;
// Entry point
public static void main(String[] args) {
// Directory that contains source files that javadoc runs on
String srcdir = System.getProperty("test.src", ".");
// Test for all cases except the split index page
runJavadoc(new String[] {"-d", TMPDEST_DIR1,
@Test
void test() {
javadoc("-d", "out",
"-doctitle", "Document Title",
"-windowtitle", "Window Title",
"-overview", (srcdir + "/overview.html"),
"-linkoffline",
"http://java.sun.com/j2se/1.4/docs/api", srcdir,
"-sourcepath", srcdir,
"p1", "p2"});
runTestsOnHTML(testArray);
printSummary();
}
/** Run javadoc */
public static void runJavadoc(String[] javadocArgs) {
if (com.sun.tools.javadoc.Main.execute(javadocArgs) != 0) {
throw new Error("Javadoc failed to execute");
}
}
/**
* Assign value for [ stringToFind, filename ]
* NOTE: The standard doclet uses the same separator "\n" for all OS's
*/
private static final String[][] testArray = {
// Test the javascript "type" attribute is present:
{ "<script type=\"text/javascript\">",
TMPDEST_DIR1 + "overview-summary.html" },
// Test onload is absent:
{ "<body>",
TMPDEST_DIR1 + "overview-summary.html" },
// Test onload is present:
{ "<body>",
TMPDEST_DIR1 + "/p1/package-summary.html" },
"-overview", testSrc("overview.html"),
"-linkoffline", "http://java.sun.com/j2se/1.4/docs/api", testSrc,
"-sourcepath", testSrc,
"p1", "p2");
checkExit(Exit.OK);
checkOutput("overview-summary.html", true,
"<script type=\"text/javascript\">",
"<body>");
// Test that "onload" is not present in BODY tag:
{ "<body>",
TMPDEST_DIR1 + "overview-frame.html" },
// Test that "onload" is not present in BODY tag:
{ "<body>",
TMPDEST_DIR1 + "allclasses-frame.html" },
// Test that "onload" is not present in BODY tag:
{ "<body>",
TMPDEST_DIR1 + "/p1/package-frame.html" },
checkOutput("p1/package-summary.html", true, "<body>");
checkOutput("overview-frame.html", true, "<body>");
checkOutput("allclasses-frame.html", true, "<body>");
checkOutput("p1/package-frame.html", true, "<body>");
// Test that win title javascript is followed by NOSCRIPT code.
{"<script type=\"text/javascript\"><!--\n" +
" try {\n" +
" if (location.href.indexOf('is-external=true') == -1) {\n" +
" parent.document.title=\"C (Window Title)\";\n" +
" }\n" +
" }\n" +
" catch(err) {\n" +
" }\n" +
"//-->\n" +
"</script>",
TMPDEST_DIR1 + "/p1/C.html"
}
};
public static void runTestsOnHTML(String[][] testArray) {
for (int i = 0; i < testArray.length; i++) {
subtestNum += 1;
// Read contents of file into a string
String fileString = readFileToString(testArray[i][1]);
// Get string to find
String stringToFind = testArray[i][0];
// Find string in file's contents
if (findString(fileString, stringToFind) == -1) {
System.out.println("\nSub-test " + (subtestNum)
+ " for bug " + BUGID + " (" + BUGNAME + ") FAILED\n"
+ "when searching for:\n"
+ stringToFind);
} else {
numSubtestsPassed += 1;
System.out.println("\nSub-test " + (subtestNum) + " passed:\n" + stringToFind);
}
}
}
public static void printSummary() {
if ( numSubtestsPassed == subtestNum ) {
System.out.println("\nAll " + numSubtestsPassed + " subtests passed");
} else {
throw new Error("\n" + (subtestNum - numSubtestsPassed) + " of " + (subtestNum)
+ " subtests failed for bug " + BUGID + " (" + BUGNAME + ")\n");
}
}
// Read the file into a String
public static String readFileToString(String filename) {
try {
File file = new File(filename);
if ( !file.exists() ) {
System.out.println("\nFILE DOES NOT EXIST: " + filename);
}
BufferedReader in = new BufferedReader(new FileReader(file));
// Create an array of characters the size of the file
char[] allChars = new char[(int)file.length()];
// Read the characters into the allChars array
in.read(allChars, 0, (int)file.length());
in.close();
// Convert to a string
String allCharsString = new String(allChars);
return allCharsString;
} catch (FileNotFoundException e) {
System.err.println(e);
return "";
} catch (IOException e) {
System.err.println(e);
return "";
}
}
public static int findString(String fileString, String stringToFind) {
return fileString.replace(NL, "\n").indexOf(stringToFind);
checkOutput("p1/C.html", true,
"<script type=\"text/javascript\"><!--\n"
+ " try {\n"
+ " if (location.href.indexOf('is-external=true') == -1) {\n"
+ " parent.document.title=\"C (Window Title)\";\n"
+ " }\n"
+ " }\n"
+ " catch(err) {\n"
+ " }\n"
+ "//-->\n"
+ "</script>");
}
}

View file

@ -21,114 +21,94 @@
* questions.
*/
import java.text.SimpleDateFormat;
import java.util.Date;
/*
* @test
* @bug 4034096 4764726 6235799
* @summary Add support for HTML keywords via META tag for
* class and member names to improve API search
* @author dkramer
* @library ../lib/
* @library ../lib
* @build JavadocTester
* @build MetaTag
* @run main MetaTag
*/
import java.text.SimpleDateFormat;
import java.util.Date;
public class MetaTag extends JavadocTester {
//Test information.
private static final SimpleDateFormat m_dateFormat = new SimpleDateFormat("yyyy-MM-dd");
//Javadoc arguments.
private static final String[] ARGS = new String[] {
"-d", OUTPUT_DIR,
"-sourcepath", SRC_DIR,
"-keywords",
"-doctitle", "Sample Packages",
"p1", "p2"
};
private static final String[] ARGS_NO_TIMESTAMP_NO_KEYWORDS = new String[] {
"-d", OUTPUT_DIR + "-2",
"-sourcepath", SRC_DIR,
"-notimestamp",
"-doctitle", "Sample Packages",
"p1", "p2"
};
//Input for string search tests.
private static final String[][] TEST = {
{ "p1/C1.html",
"<meta name=\"keywords\" content=\"p1.C1 class\">" },
{ "p1/C1.html",
"<meta name=\"keywords\" content=\"field1\">" },
{ "p1/C1.html",
"<meta name=\"keywords\" content=\"field2\">" },
{ "p1/C1.html",
"<meta name=\"keywords\" content=\"method1()\">" },
{ "p1/C1.html",
"<meta name=\"keywords\" content=\"method2()\">" },
{ "p1/package-summary.html",
"<meta name=\"keywords\" content=\"p1 package\">" },
{ "overview-summary.html",
"<meta name=\"keywords\" content=\"Overview, Sample Packages\">" },
//NOTE: Hopefully, this regression test is not run at midnight. If the output
//was generated yesterday and this test is run today, the test will fail.
{ "overview-summary.html",
"<meta name=\"date\" "
+ "content=\"" + m_dateFormat.format(new Date()) + "\">"},
};
private static final String[][] NEGATED_TEST2 = {
//No keywords when -keywords is not used.
{ "p1/C1.html",
"<META NAME=\"keywords\" CONTENT=\"p1.C1 class\">" },
{ "p1/C1.html",
"<META NAME=\"keywords\" CONTENT=\"field1\">" },
{ "p1/C1.html",
"<META NAME=\"keywords\" CONTENT=\"field2\">" },
{ "p1/C1.html",
"<META NAME=\"keywords\" CONTENT=\"method1()\">" },
{ "p1/C1.html",
"<META NAME=\"keywords\" CONTENT=\"method2()\">" },
{ "p1/package-summary.html",
"<META NAME=\"keywords\" CONTENT=\"p1 package\">" },
{ "overview-summary.html",
"<META NAME=\"keywords\" CONTENT=\"Overview Summary, Sample Packages\">" },
//The date metatag should not show up when -notimestamp is used.
//NOTE: Hopefully, this regression test is not run at midnight. If the output
//was generated yesterday and this test is run today, the test will fail.
{ "overview-summary.html",
"<META NAME=\"date\" "
+ "CONTENT=\"" + m_dateFormat.format(new Date()) + "\">"},
};
/**
* The entry point of the test.
* @param args the array of command line arguments.
* @param args the array of command line arguments
* @throws Exception if the test fails
*/
public static void main(String[] args) {
public static void main(String... args) throws Exception {
MetaTag tester = new MetaTag();
tester.run(ARGS, TEST, NO_TEST);
tester.run(ARGS_NO_TIMESTAMP_NO_KEYWORDS, NO_TEST, NEGATED_TEST2);
tester.printSummary();
tester.runTests();
}
@Test
void testStandard() {
javadoc("-d", "out-1",
"-sourcepath", testSrc,
"-keywords",
"-doctitle", "Sample Packages",
"p1", "p2");
checkExit(Exit.OK);
checkOutput("p1/C1.html", true,
"<meta name=\"keywords\" content=\"p1.C1 class\">",
"<meta name=\"keywords\" content=\"field1\">",
"<meta name=\"keywords\" content=\"field2\">",
"<meta name=\"keywords\" content=\"method1()\">",
"<meta name=\"keywords\" content=\"method2()\">");
checkOutput("p1/package-summary.html", true,
"<meta name=\"keywords\" content=\"p1 package\">");
checkOutput("overview-summary.html", true,
"<meta name=\"keywords\" content=\"Overview, Sample Packages\">");
// NOTE: Hopefully, this regression test is not run at midnight. If the output
// was generated yesterday and this test is run today, the test will fail.
checkOutput("overview-summary.html", true,
"<meta name=\"date\" content=\"" + date() + "\">");
}
@Test
void testNoTimestamp() {
javadoc("-d", "out-2",
"-sourcepath", testSrc,
"-notimestamp",
"-doctitle", "Sample Packages",
"p1", "p2");
checkExit(Exit.OK);
// No keywords when -keywords is not used.
checkOutput("p1/C1.html", false,
"<META NAME=\"keywords\" CONTENT=\"p1.C1 class\">",
"<META NAME=\"keywords\" CONTENT=\"field1\">",
"<META NAME=\"keywords\" CONTENT=\"field2\">",
"<META NAME=\"keywords\" CONTENT=\"method1()\">",
"<META NAME=\"keywords\" CONTENT=\"method2()\">");
checkOutput("p1/package-summary.html", false,
"<META NAME=\"keywords\" CONTENT=\"p1 package\">");
checkOutput("overview-summary.html", false,
"<META NAME=\"keywords\" CONTENT=\"Overview Summary, Sample Packages\">");
// The date metatag should not show up when -notimestamp is used.
// NOTE: Hopefully, this regression test is not run at midnight. If the output
// was generated yesterday and this test is run today, the test will fail.
checkOutput("overview-summary.html", false,
"<META NAME=\"date\" CONTENT=\"" + date() + "\">");
}
private static final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
String date() {
return dateFormat.format(new Date());
}
}

View file

@ -28,83 +28,62 @@
* is present for three sets of options: (1) -header,
* (2) -packagesheader, and (3) -header -packagesheader
* @author dkramer
* @library ../lib/
* @library ../lib
* @build JavadocTester
* @build PackagesHeader
* @run main PackagesHeader
*/
public class PackagesHeader extends JavadocTester {
//Test information.
private static final String OUTPUT_DIR1 = OUTPUT_DIR + "-1/";
private static final String OUTPUT_DIR2 = OUTPUT_DIR + "-2/";
private static final String OUTPUT_DIR3 = OUTPUT_DIR + "-3/";
public static void main(String... args) throws Exception {
JavadocTester tester = new PackagesHeader();
tester.runTests();
}
/**
* Assign value for [ fileToSearch, stringToFind ]
*/
private static final String[][] TESTARRAY1 = {
@Test
void testHeader() {
// First test with -header only
javadoc("-d", "out-header",
"-header", "Main Frame Header",
"-sourcepath", testSrc,
"p1", "p2");
checkExit(Exit.OK);
// Test that the -header shows up in the packages frame
{ "overview-frame.html",
"Main Frame Header" }
};
checkOutput("overview-frame.html", true,
"Main Frame Header");
}
private static final String[][] TESTARRAY2 = {
@Test
void testPackagesHeader() {
// Second test with -packagesheader only
javadoc("-d", "out-packages-header",
"-packagesheader", "Packages Frame Header",
"-sourcepath", testSrc,
"p1", "p2");
checkExit(Exit.OK);
// Test that the -packagesheader string shows
// up in the packages frame
checkOutput("overview-frame.html", true,
"Packages Frame Header");
}
{ "overview-frame.html",
"Packages Frame Header" }
};
private static final String[][] TESTARRAY3 = {
@Test
void testBothHeaders() {
// Third test with both -packagesheader and -header
javadoc("-d", "out-both",
"-packagesheader", "Packages Frame Header",
"-header", "Main Frame Header",
"-sourcepath", testSrc,
"p1", "p2");
checkExit(Exit.OK);
// Test that the both headers show up and are different
checkOutput("overview-frame.html", true,
"Packages Frame Header");
{ "overview-frame.html",
"Packages Frame Header" },
{ "overview-summary.html",
"Main Frame Header" }
};
// First test with -header only
private static final String[] JAVADOC_ARGS1 = new String[] {
"-d", OUTPUT_DIR1,
"-header", "Main Frame Header",
"-sourcepath", SRC_DIR,
"p1", "p2"};
// Second test with -packagesheader only
private static final String[] JAVADOC_ARGS2 = new String[] {
"-d", OUTPUT_DIR2,
"-packagesheader", "Packages Frame Header",
"-sourcepath", SRC_DIR,
"p1", "p2"};
// Third test with both -packagesheader and -header
private static final String[] JAVADOC_ARGS3 = new String[] {
"-d", OUTPUT_DIR3,
"-packagesheader", "Packages Frame Header",
"-header", "Main Frame Header",
"-sourcepath", SRC_DIR,
"p1", "p2"};
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
JavadocTester tester = new PackagesHeader();
tester.run(JAVADOC_ARGS1, TESTARRAY1, NO_TEST);
tester.run(JAVADOC_ARGS2, TESTARRAY2, NO_TEST);
tester.run(JAVADOC_ARGS3, TESTARRAY3, NO_TEST);
tester.printSummary();
checkOutput("overview-summary.html", true,
"Main Frame Header");
}
}

View file

@ -25,24 +25,24 @@
* @test
* @bug 6735320
* @summary javadoc throws exception if serialField value is missing
* @library ../lib/
* @build JavadocTester T6735320
* @library ../lib
* @build JavadocTester
* @run main T6735320
*/
public class T6735320 extends JavadocTester {
private static final String[] ARGS = new String[]{
"-d", OUTPUT_DIR + ".out",
SRC_DIR + "/SerialFieldTest.java"
};
public static void main(String... args) {
public static void main(String... args) throws Exception {
T6735320 tester = new T6735320();
if (tester.runJavadoc(ARGS) == 0) {
throw new AssertionError("zero return code from javadoc");
}
if (tester.getErrorOutput().contains("StringIndexOutOfBoundsException")) {
throw new AssertionError("javadoc threw StringIndexOutOfBoundsException");
tester.runTests();
}
@Test
void test() {
javadoc("-d", "out",
testSrc("SerialFieldTest.java"));
checkExit(Exit.FAILED);
checkOutput(Output.STDERR, false,
"StringIndexOutOfBoundsException");
}
}

View file

@ -30,174 +30,52 @@
* <NOFRAMES> not allowed outside <FRAMESET> element
* HTML table tags inserted in wrong place in pakcage use page
* @author dkramer
* @library ../lib
* @build JavadocTester
* @run main ValidHtml
*/
import com.sun.javadoc.*;
import java.util.*;
import java.io.*;
public class ValidHtml extends JavadocTester {
/**
* Runs javadoc and runs regression tests on the resulting HTML.
* It reads each file, complete with newlines, into a string to easily
* find strings that contain newlines.
*/
public class ValidHtml {
protected static final String NL = System.getProperty("line.separator");
private static final String BUGID = "4275630";
private static final String BUGNAME = "ValidHtml";
private static final String TMPDEST_DIR1 = "./docs1/";
private static final String TMPDEST_DIR2 = "./docs2/";
// Subtest number. Needed because runResultsOnHTML is run twice,
// and subtestNum should increment across subtest runs.
public static int subtestNum = 0;
public static int numSubtestsPassed = 0;
// Entry point
public static void main(String[] args) {
// Directory that contains source files that javadoc runs on
String srcdir = System.getProperty("test.src", ".");
public static void main(String... args) throws Exception {
ValidHtml tester = new ValidHtml();
tester.runTests();
}
@Test
void test() {
// Test for all cases except the split index page
runJavadoc(new String[]{"-d", TMPDEST_DIR1,
javadoc("-d", "out",
"-doctitle", "Document Title",
"-windowtitle", "Window Title",
"-use",
"-overview", (srcdir + "/overview.html"),
"-sourcepath", srcdir,
"p1", "p2"
});
runTestsOnHTML(testArray);
"-overview", testSrc("overview.html"),
"-sourcepath", testSrc,
"p1", "p2");
checkExit(Exit.OK);
printSummary();
}
// Test the proper DOCTYPE element are present:
checkOutput("index.html", true, FRAMESET);
checkOutput("overview-summary.html", true, LOOSE);
checkOutput("p1/package-summary.html", true, LOOSE);
checkOutput("p1/C.html", true, LOOSE);
checkOutput("overview-frame.html", true, LOOSE);
checkOutput("allclasses-frame.html", true, LOOSE);
checkOutput("p1/package-frame.html", true, LOOSE);
/** Run javadoc */
public static void runJavadoc(String[] javadocArgs) {
if (com.sun.tools.javadoc.Main.execute(javadocArgs) != 0) {
throw new Error("Javadoc failed to execute");
}
}
/**
* Assign value for [ stringToFind, filename ]
* NOTE: The standard doclet uses the same separator "\n" for all OS's
*/
private static final String[][] testArray = {
// Test the proper DOCTYPE element is present:
{
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Frameset//EN\" \"http://www.w3.org/TR/html4/frameset.dtd\">",
TMPDEST_DIR1 + "index.html"
},
// Test the proper DOCTYPE element is present:
{
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">",
TMPDEST_DIR1 + "overview-summary.html"
},
// Test the proper DOCTYPE element is present:
{
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">",
TMPDEST_DIR1 + "p1/package-summary.html"
},
// Test the proper DOCTYPE element is present:
{
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">",
TMPDEST_DIR1 + "p1/C.html"
},
// Test the proper DOCTYPE element is present:
{
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">",
TMPDEST_DIR1 + "overview-frame.html"
},
// Test the proper DOCTYPE element is present:
{
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">",
TMPDEST_DIR1 + "allclasses-frame.html"
},
// Test the proper DOCTYPE element is present:
{
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">",
TMPDEST_DIR1 + "p1/package-frame.html"
},
// Test that <NOFRAMES> is inside <FRAMESET> element:
{
"</noframes>\n" +
"</frameset>",
TMPDEST_DIR1 + "index.html"
},
checkOutput("index.html", true,
"</noframes>\n"
+ "</frameset>");
// Test the table elements are in the correct order:
{
"</td>\n" +
"</tr>",
TMPDEST_DIR1 + "/p1/package-use.html"
}
};
public static void runTestsOnHTML(String[][] testArray) {
for (int i = 0; i < testArray.length; i++) {
subtestNum += 1;
// Read contents of file into a string
String fileString = readFileToString(testArray[i][1]);
// Get string to find
String stringToFind = testArray[i][0];
// Find string in file's contents
if (findString(fileString, stringToFind) == -1) {
System.out.println("\nSub-test " + (subtestNum) + " for bug " + BUGID + " (" + BUGNAME + ") FAILED\n" + "when searching for:\n" + stringToFind);
} else {
numSubtestsPassed += 1;
System.out.println("\nSub-test " + (subtestNum) + " passed:\n" + stringToFind);
}
}
checkOutput("p1/package-use.html", true,
"</td>\n"
+ "</tr>");
}
public static void printSummary() {
if (numSubtestsPassed == subtestNum) {
System.out.println("\nAll " + numSubtestsPassed + " subtests passed");
} else {
throw new Error("\n" + (subtestNum - numSubtestsPassed) + " of " + (subtestNum) + " subtests failed for bug " + BUGID + " (" + BUGNAME + ")\n");
}
}
// Read the file into a String
public static String readFileToString(String filename) {
try {
File file = new File(filename);
if (!file.exists()) {
System.out.println("\nFILE DOES NOT EXIST: " + filename);
}
BufferedReader in = new BufferedReader(new FileReader(file));
// Create an array of characters the size of the file
char[] allChars = new char[(int) file.length()];
// Read the characters into the allChars array
in.read(allChars, 0, (int) file.length());
in.close();
// Convert to a string
String allCharsString = new String(allChars);
return allCharsString;
} catch (FileNotFoundException e) {
System.err.println(e);
return "";
} catch (IOException e) {
System.err.println(e);
return "";
}
}
public static int findString(String fileString, String stringToFind) {
return fileString.replace(NL, "\n").indexOf(stringToFind);
}
private static final String FRAMESET =
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Frameset//EN\" \"http://www.w3.org/TR/html4/frameset.dtd\">";
private static final String LOOSE =
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">";
}

View file

@ -26,131 +26,31 @@
* @bug 4720849
* @summary com.sun.tools.doclets.standard.Standard contains hard-coded version number
* @author dkramer
* @library ../lib
* @build JavadocTester
* @run main VersionNumber
*/
import com.sun.javadoc.*;
import java.util.*;
import java.io.*;
/**
* Runs javadoc and runs regression tests on the resulting HTML.
* It reads each file, complete with newlines, into a string to easily
* find strings that contain newlines.
*/
public class VersionNumber {
public class VersionNumber extends JavadocTester {
private static final String BUGID = "4720849";
private static final String BUGNAME = "VersionNumber";
private static final String TMPDEST_DIR1 = "./docs1/";
private static final String TMPDEST_DIR2 = "./docs2/";
// Subtest number. Needed because runResultsOnHTML is run twice,
// and subtestNum should increment across subtest runs.
public static int subtestNum = 0;
public static int numSubtestsPassed = 0;
// Entry point
public static void main(String[] args) {
// Directory that contains source files that javadoc runs on
String srcdir = System.getProperty("test.src", ".");
// Test for all cases except the split index page
runJavadoc(new String[] {"-d", TMPDEST_DIR1,
"p1"});
runTestsOnHTML(testArray);
printSummary();
public static void main(String... args) throws Exception {
VersionNumber tester = new VersionNumber();
tester.runTests();
}
/** Run javadoc */
public static void runJavadoc(String[] javadocArgs) {
if (com.sun.tools.javadoc.Main.execute(javadocArgs) != 0) {
throw new Error("Javadoc failed to execute");
}
}
/**
* Assign value for [ stringToFind, filename ]
* NOTE: The standard doclet uses the same separator "\n" for all OS's
*/
private static final String[][] testArray = {
@Test
void test() {
javadoc("-d", "out",
"p1");
checkExit(Exit.OK);
// Test the proper DOCTYPE element is present:
{
"<!-- Generated by javadoc (",
TMPDEST_DIR1 + "p1/C.html" },
};
public static void runTestsOnHTML(String[][] testArray) {
for (int i = 0; i < testArray.length; i++) {
subtestNum += 1;
// Read contents of file into a string
String fileString = readFileToString(testArray[i][1]);
// Get string to find
String stringToFind = testArray[i][0];
// Find string in file's contents
if (findString(fileString, stringToFind) == -1) {
System.out.println("\nSub-test " + (subtestNum)
+ " for bug " + BUGID + " (" + BUGNAME + ") FAILED\n"
+ "when searching for:\n"
+ stringToFind);
} else {
numSubtestsPassed += 1;
System.out.println("\nSub-test " + (subtestNum) + " passed:\n" + stringToFind);
}
}
checkOutput("p1/C.html", true,
"<!-- Generated by javadoc (");
}
public static void printSummary() {
if ( numSubtestsPassed == subtestNum ) {
System.out.println("\nAll " + numSubtestsPassed + " subtests passed");
} else {
throw new Error("\n" + (subtestNum - numSubtestsPassed) + " of " + (subtestNum)
+ " subtests failed for bug " + BUGID + " (" + BUGNAME + ")\n");
}
}
// Read the file into a String
public static String readFileToString(String filename) {
try {
File file = new File(filename);
if ( !file.exists() ) {
System.out.println("\nFILE DOES NOT EXIST: " + filename);
}
BufferedReader in = new BufferedReader(new FileReader(file));
// Create an array of characters the size of the file
char[] allChars = new char[(int)file.length()];
// Read the characters into the allChars array
in.read(allChars, 0, (int)file.length());
in.close();
// Convert to a string
String allCharsString = new String(allChars);
return allCharsString;
} catch (FileNotFoundException e) {
System.err.println(e);
return "";
} catch (IOException e) {
System.err.println(e);
return "";
}
}
public static int findString(String fileString, String stringToFind) {
return fileString.indexOf(stringToFind);
}
}

View file

@ -26,193 +26,62 @@
* @bug 4530730
* @summary stddoclet: With frames off, window titles have "()" appended
* @author dkramer
* @library ../lib
* @build JavadocTester
* @run main WindowTitles
*/
import com.sun.javadoc.*;
import java.util.*;
import java.io.*;
// If needing regular expression pattern matching,
// see /java/pubs/dev/linkfix/src/LinkFix.java
/**
* Runs javadoc and runs regression tests on the resulting HTML.
* It reads each file, complete with newlines, into a string to easily
* find strings that contain newlines.
*/
public class WindowTitles
{
private static final String BUGID = "4530730";
private static final String BUGNAME = "WindowTitles";
private static final String TMPDIR_STRING1 = "./docs1/";
private static final String TMPDIR_STRING2 = "./docs2/";
public class WindowTitles extends JavadocTester {
// Subtest number. Needed because runResultsOnHTML is run twice, and subtestNum
// should increment across subtest runs.
public static int subtestNum = 0;
public static int numSubtestsPassed = 0;
// Entry point
public static void main(String[] args) {
// Directory that contains source files that javadoc runs on
String srcdir = System.getProperty("test.src", ".");
public static void main(String... args) throws Exception {
WindowTitles tester = new WindowTitles();
tester.runTests();
}
@Test
void test() {
// Test for all cases except the split index page
runJavadoc(new String[] {"-d", TMPDIR_STRING1,
javadoc("-d", "out-1",
"-use",
"-sourcepath", srcdir,
"p1", "p2"});
runTestsOnHTML(testArray);
"-sourcepath", testSrc,
"p1", "p2");
checkExit(Exit.OK);
checkTitle("overview-summary.html", "Overview");
checkTitle("overview-tree.html", "Class Hierarchy");
checkTitle("overview-frame.html", "Overview List");
checkTitle("p1/package-summary.html", "p1");
checkTitle("p1/package-frame.html", "p1");
checkTitle("p1/package-tree.html", "p1 Class Hierarchy");
checkTitle("p1/package-use.html", "Uses of Package p1");
checkTitle("p1/C1.html", "C1");
checkTitle("allclasses-frame.html", "All Classes");
checkTitle("allclasses-noframe.html", "All Classes");
checkTitle("constant-values.html", "Constant Field Values");
checkTitle("deprecated-list.html", "Deprecated List");
checkTitle("serialized-form.html", "Serialized Form");
checkTitle("help-doc.html", "API Help");
checkTitle("index-all.html", "Index");
checkTitle("p1/class-use/C1.html", "Uses of Class p1.C1");
}
@Test
void test2() {
// Test only for the split-index case (and run on only one package)
System.out.println(""); // blank line
runJavadoc(new String[] {"-d", TMPDIR_STRING2,
javadoc("-d", "out-2",
"-splitindex",
"-sourcepath", System.getProperty("test.src", "."),
"p1"});
runTestsOnHTML(testSplitIndexArray);
"-sourcepath", testSrc,
"p1");
checkExit(Exit.OK);
printSummary();
checkTitle("index-files/index-1.html", "C-Index");
}
/** Run javadoc */
public static void runJavadoc(String[] javadocArgs) {
if (com.sun.tools.javadoc.Main.execute(javadocArgs) != 0) {
throw new Error("Javadoc failed to execute");
}
void checkTitle(String file, String title) {
checkOutput(file, true, "<title>" + title + "</title>");
}
/**
* Assign value for [ stringToFind, filename ]
* NOTE: The standard doclet uses platform-specific line separators ("\n")
*/
private static final String[][] testArray = {
{ "<title>Overview</title>",
TMPDIR_STRING1 + "overview-summary.html" },
{ "<title>Class Hierarchy</title>",
TMPDIR_STRING1 + "overview-tree.html" },
{ "<title>Overview List</title>",
TMPDIR_STRING1 + "overview-frame.html" },
{ "<title>p1</title>",
TMPDIR_STRING1 + "p1/package-summary.html" },
{ "<title>p1</title>",
TMPDIR_STRING1 + "p1/package-frame.html" },
{ "<title>p1 Class Hierarchy</title>",
TMPDIR_STRING1 + "p1/package-tree.html" },
{ "<title>Uses of Package p1</title>",
TMPDIR_STRING1 + "p1/package-use.html" },
{ "<title>C1</title>",
TMPDIR_STRING1 + "p1/C1.html" },
{ "<title>All Classes</title>",
TMPDIR_STRING1 + "allclasses-frame.html" },
{ "<title>All Classes</title>",
TMPDIR_STRING1 + "allclasses-noframe.html" },
{ "<title>Constant Field Values</title>",
TMPDIR_STRING1 + "constant-values.html" },
{ "<title>Deprecated List</title>",
TMPDIR_STRING1 + "deprecated-list.html" },
{ "<title>Serialized Form</title>",
TMPDIR_STRING1 + "serialized-form.html" },
{ "<title>API Help</title>",
TMPDIR_STRING1 + "help-doc.html" },
{ "<title>Index</title>",
TMPDIR_STRING1 + "index-all.html" },
{ "<title>Uses of Class p1.C1</title>",
TMPDIR_STRING1 + "p1/class-use/C1.html" },
};
/**
* Assign value for [ stringToFind, filename ] for split index page
*/
private static final String[][] testSplitIndexArray = {
{ "<title>C-Index</title>",
TMPDIR_STRING2 + "index-files/index-1.html" },
};
public static void runTestsOnHTML(String[][] testArray) {
for (int i = 0; i < testArray.length; i++) {
subtestNum += 1;
// Read contents of file into a string
String fileString = readFileToString(testArray[i][1]);
// Get string to find
String stringToFind = testArray[i][0];
// Find string in file's contents
if (findString(fileString, stringToFind) == -1) {
System.out.println("\nSub-test " + (subtestNum)
+ " for bug " + BUGID + " (" + BUGNAME + ") FAILED\n"
+ "when searching for:\n"
+ stringToFind);
} else {
numSubtestsPassed += 1;
System.out.println("\nSub-test " + (subtestNum) + " passed:\n" + stringToFind);
}
}
}
public static void printSummary() {
if ( numSubtestsPassed == subtestNum ) {
System.out.println("\nAll " + numSubtestsPassed + " subtests passed");
} else {
throw new Error("\n" + (subtestNum - numSubtestsPassed) + " of " + (subtestNum)
+ " subtests failed for bug " + BUGID + " (" + BUGNAME + ")\n");
}
}
// Read the file into a String
public static String readFileToString(String filename) {
try {
File file = new File(filename);
if ( !file.exists() ) {
System.out.println("\nFILE DOES NOT EXIST: " + filename);
}
BufferedReader in = new BufferedReader(new FileReader(file));
// Create an array of characters the size of the file
char[] allChars = new char[(int)file.length()];
// Read the characters into the allChars array
in.read(allChars, 0, (int)file.length());
in.close();
// Convert to a string
String allCharsString = new String(allChars);
return allCharsString;
} catch (FileNotFoundException e) {
System.err.println(e);
return "";
} catch (IOException e) {
System.err.println(e);
return "";
}
}
public static int findString(String fileString, String stringToFind) {
return fileString.indexOf(stringToFind);
}
}

View file

@ -26,42 +26,30 @@
* @bug 4504730 4526070 5077317
* @summary Test the generation of constant-values.html.
* @author jamieh
* @library ../lib/
* @library ../lib
* @build JavadocTester
* @build TestConstantValuesDriver
* @run main TestConstantValuesDriver
*/
public class TestConstantValuesDriver extends JavadocTester {
private static final String[] ARGS = new String[] {
"-d", OUTPUT_DIR, SRC_DIR + "/TestConstantValues.java",
SRC_DIR + "/TestConstantValues2.java",
SRC_DIR + "/A.java"
};
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
String[][] tests = new String[5][2];
for (int i = 0; i < tests.length-1; i++) {
tests[i][0] = "constant-values.html";
tests[i][1] = "TEST"+(i+1)+"PASSES";
}
tests[tests.length-1][0] = "constant-values.html";
tests[tests.length-1][1] = "<code>\"&lt;Hello World&gt;\"</code>";
public static void main(String... args) throws Exception {
TestConstantValuesDriver tester = new TestConstantValuesDriver();
tester.run(ARGS, tests, NO_TEST);
tester.printSummary();
tester.runTests();
}
/**
* @throws java.io.IOException Test 1 passes
* @throws java.io.IOException Test 2 passes
* @throws java.lang.NullPointerException comment three
* @throws java.io.IOException Test 3 passes
*/
public void method(){}
@Test
void test() {
javadoc("-d", "out",
testSrc("TestConstantValues.java"),
testSrc("TestConstantValues2.java"),
testSrc("A.java"));
checkExit(Exit.OK);
checkOutput("constant-values.html", true,
"TEST1PASSES",
"TEST2PASSES",
"TEST3PASSES",
"TEST4PASSES",
"<code>\"&lt;Hello World&gt;\"</code>");
}
}

View file

@ -26,30 +26,28 @@
* @bug 4525364
* @summary Determine if duplicate throws tags can be used.
* @author jamieh
* @library ../lib/
* @library ../lib
* @build JavadocTester
* @build TestDupThrowsTags
* @run main TestDupThrowsTags
*/
public class TestDupThrowsTags extends JavadocTester {
private static final String[] ARGS = new String[] {
"-d", OUTPUT_DIR, SRC_DIR + "/TestDupThrowsTags.java"
};
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
String[][] tests = new String[4][2];
for (int i = 0; i < tests.length; i++) {
tests[i][0] = "TestDupThrowsTags.html";
tests[i][1] = "Test "+(i+1)+" passes";
}
public static void main(String... args) throws Exception {
TestDupThrowsTags tester = new TestDupThrowsTags();
tester.run(ARGS, tests, NO_TEST);
tester.printSummary();
tester.runTests();
}
@Test
void test() {
javadoc("-d", "out",
testSrc("TestDupThrowsTags.java"));
checkExit(Exit.FAILED);
checkOutput("TestDupThrowsTags.html", true,
"Test 1 passes",
"Test 2 passes",
"Test 3 passes",
"Test 4 passes");
}
/**

File diff suppressed because it is too large Load diff

View file

@ -26,33 +26,31 @@
* @bug 4640745
* @summary This test verifys that the -link option handles absolute paths.
* @author jamieh
* @library ../lib/
* @library ../lib
* @build JavadocTester
* @build TestAbsLinkPath
* @run main TestAbsLinkPath
*/
public class TestAbsLinkPath extends JavadocTester {
private static final String[][] TEST = {
{ "pkg1/C1.html", "C2.html"}};
private static final String[] ARGS1 =
new String[] {
"-d", "tmp2", "-sourcepath", SRC_DIR, "pkg2"};
private static final String[] ARGS2 =
new String[] {
"-d", "tmp", "-sourcepath", SRC_DIR,
"-link", "../tmp2", "pkg1"};
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
public static void main(String... args) throws Exception {
TestAbsLinkPath tester = new TestAbsLinkPath();
tester.run(ARGS1, NO_TEST, NO_TEST);
tester.run(ARGS2, TEST, NO_TEST);
tester.printSummary();
tester.runTests();
}
@Test
void test1() {
String out1 = "out1";
javadoc("-d", out1, "-sourcepath", testSrc, "pkg2");
checkExit(Exit.OK);
javadoc("-d", "out2",
"-sourcepath", testSrc,
"-link", "../" + out1,
"pkg1");
checkExit(Exit.OK);
checkOutput("pkg1/C1.html", true,
"C2.html");
}
}

View file

@ -27,80 +27,72 @@
* @summary Make sure that the abstract method is identified correctly
* if the abstract modifier is present explicitly or implicitly.
* @author bpatel
* @library ../lib/
* @build JavadocTester TestAbstractMethod
* @library ../lib
* @build JavadocTester
* @run main TestAbstractMethod
*/
public class TestAbstractMethod extends JavadocTester {
//Test information.
//Javadoc arguments.
private static final String[] ARGS = new String[] {
"-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg"
};
//Input for string search tests.
private static final String[][] TEST = {
{ "pkg/A.html",
"<td class=\"colFirst\"><code>default void</code></td>"},
{ "pkg/A.html",
"<caption><span id=\"t0\" class=\"activeTableTab\"><span>" +
"All Methods</span><span class=\"tabEnd\">&nbsp;</span></span>" +
"<span id=\"t2\" class=\"tableTab\"><span>" +
"<a href=\"javascript:show(2);\">Instance Methods</a></span>" +
"<span class=\"tabEnd\">&nbsp;</span></span><span id=\"t3\" " +
"class=\"tableTab\"><span><a href=\"javascript:show(4);\">" +
"Abstract Methods</a></span><span class=\"tabEnd\">&nbsp;</span>" +
"</span><span id=\"t5\" class=\"tableTab\"><span>" +
"<a href=\"javascript:show(16);\">Default Methods</a></span>" +
"<span class=\"tabEnd\">&nbsp;</span></span></caption>"},
{ "pkg/B.html",
"<caption><span id=\"t0\" class=\"activeTableTab\"><span>" +
"All Methods</span><span class=\"tabEnd\">&nbsp;</span></span>" +
"<span id=\"t2\" class=\"tableTab\"><span>" +
"<a href=\"javascript:show(2);\">Instance Methods</a></span>" +
"<span class=\"tabEnd\">&nbsp;</span></span><span id=\"t3\" " +
"class=\"tableTab\"><span><a href=\"javascript:show(4);\">Abstract " +
"Methods</a></span><span class=\"tabEnd\">&nbsp;</span></span>" +
"<span id=\"t4\" class=\"tableTab\"><span>" +
"<a href=\"javascript:show(8);\">Concrete Methods</a></span>" +
"<span class=\"tabEnd\">&nbsp;</span></span></caption>"},
{ "pkg/B.html",
"<td class=\"colFirst\"><code>abstract void</code></td>"},
{ "pkg/C.html",
"<caption><span id=\"t0\" class=\"activeTableTab\"><span>" +
"All Methods</span><span class=\"tabEnd\">&nbsp;</span></span>" +
"<span id=\"t2\" class=\"tableTab\"><span>" +
"<a href=\"javascript:show(2);\">Instance Methods</a></span>" +
"<span class=\"tabEnd\">&nbsp;</span></span>" +
"<span id=\"t5\" class=\"tableTab\"><span>" +
"<a href=\"javascript:show(16);\">Default Methods</a></span>" +
"<span class=\"tabEnd\">&nbsp;</span></span></caption>"},
{ "pkg/C.html",
"<td class=\"colFirst\"><code>default void</code></td>"}
};
private static final String[][] NEGATED_TEST = {
{ "pkg/A.html",
"<td class=\"colFirst\"><code>abstract void</code></td>"},
{ "pkg/B.html",
"<span><a href=\"javascript:show(16);\">Default Methods</a></span>" +
"<span class=\"tabEnd\">&nbsp;</span>"},
{ "pkg/B.html",
"<td class=\"colFirst\"><code>default void</code></td>"},
{ "pkg/C.html",
"<span><a href=\"javascript:show(4);\">Abstract Methods</a></span>" +
"<span class=\"tabEnd\">&nbsp;</span>"}
};
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
public static void main(String... args) throws Exception {
TestAbstractMethod tester = new TestAbstractMethod();
tester.run(ARGS, TEST, NEGATED_TEST);
tester.printSummary();
tester.runTests();
}
@Test
void test() {
javadoc("-d", "out",
"-sourcepath", testSrc,
"pkg");
checkExit(Exit.OK);
checkOutput("pkg/A.html", true,
"<td class=\"colFirst\"><code>default void</code></td>",
"<caption><span id=\"t0\" class=\"activeTableTab\"><span>"
+ "All Methods</span><span class=\"tabEnd\">&nbsp;</span></span>"
+ "<span id=\"t2\" class=\"tableTab\"><span>"
+ "<a href=\"javascript:show(2);\">Instance Methods</a></span>"
+ "<span class=\"tabEnd\">&nbsp;</span></span><span id=\"t3\" "
+ "class=\"tableTab\"><span><a href=\"javascript:show(4);\">"
+ "Abstract Methods</a></span><span class=\"tabEnd\">&nbsp;</span>"
+ "</span><span id=\"t5\" class=\"tableTab\"><span>"
+ "<a href=\"javascript:show(16);\">Default Methods</a></span>"
+ "<span class=\"tabEnd\">&nbsp;</span></span></caption>");
checkOutput("pkg/B.html", true,
"<caption><span id=\"t0\" class=\"activeTableTab\"><span>"
+ "All Methods</span><span class=\"tabEnd\">&nbsp;</span></span>"
+ "<span id=\"t2\" class=\"tableTab\"><span>"
+ "<a href=\"javascript:show(2);\">Instance Methods</a></span>"
+ "<span class=\"tabEnd\">&nbsp;</span></span><span id=\"t3\" "
+ "class=\"tableTab\"><span><a href=\"javascript:show(4);\">Abstract "
+ "Methods</a></span><span class=\"tabEnd\">&nbsp;</span></span>"
+ "<span id=\"t4\" class=\"tableTab\"><span>"
+ "<a href=\"javascript:show(8);\">Concrete Methods</a></span>"
+ "<span class=\"tabEnd\">&nbsp;</span></span></caption>",
"<td class=\"colFirst\"><code>abstract void</code></td>");
checkOutput("pkg/C.html", true,
"<caption><span id=\"t0\" class=\"activeTableTab\"><span>"
+ "All Methods</span><span class=\"tabEnd\">&nbsp;</span></span>"
+ "<span id=\"t2\" class=\"tableTab\"><span>"
+ "<a href=\"javascript:show(2);\">Instance Methods</a></span>"
+ "<span class=\"tabEnd\">&nbsp;</span></span>"
+ "<span id=\"t5\" class=\"tableTab\"><span>"
+ "<a href=\"javascript:show(16);\">Default Methods</a></span>"
+ "<span class=\"tabEnd\">&nbsp;</span></span></caption>",
"<td class=\"colFirst\"><code>default void</code></td>");
checkOutput("pkg/A.html", false,
"<td class=\"colFirst\"><code>abstract void</code></td>");
checkOutput("pkg/B.html", false,
"<span><a href=\"javascript:show(16);\">Default Methods</a></span>"
+ "<span class=\"tabEnd\">&nbsp;</span>",
"<td class=\"colFirst\"><code>default void</code></td>");
checkOutput("pkg/C.html", false,
"<span><a href=\"javascript:show(4);\">Abstract Methods</a></span>"
+ "<span class=\"tabEnd\">&nbsp;</span>");
}
}

View file

@ -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
//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");
}
}

View file

@ -27,32 +27,26 @@
* @summary Make sure that annotations types with optional elements have
* element headers
* @author Mahmood Ali
* @library ../lib/
* @library ../lib
* @build JavadocTester
* @build TestAnnotationOptional
* @run main TestAnnotationOptional
*/
public class TestAnnotationOptional extends JavadocTester {
//Javadoc arguments.
private static final String[] ARGS = new String[] {
"-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg"
};
//Input for string search tests.
private static final String[][] TEST = {
{ "pkg/AnnotationOptional.html",
"<a name=\"annotation.type.element.detail\">"
}
};
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
public static void main(String... args) throws Exception {
TestAnnotationOptional tester = new TestAnnotationOptional();
tester.run(ARGS, TEST, NO_TEST);
tester.printSummary();
tester.runTests();
}
@Test
void test() {
javadoc("-d", "out",
"-sourcepath", testSrc,
"pkg");
checkExit(Exit.OK);
checkOutput("pkg/AnnotationOptional.html", true,
"<a name=\"annotation.type.element.detail\">");
}
}

View file

@ -27,64 +27,52 @@
* @summary Make sure that annotation types with 0 members does not have
* extra HR tags.
* @author jamieh
* @library ../lib/
* @build JavadocTester TestAnnotationTypes
* @library ../lib
* @build JavadocTester
* @run main TestAnnotationTypes
*/
public class TestAnnotationTypes extends JavadocTester {
//Javadoc arguments.
private static final String[] ARGS = new String[] {
"-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg"
};
//Input for string search tests.
private static final String[][] TEST = {
{ "pkg/AnnotationTypeField.html",
"<li>Summary:&nbsp;</li>\n" +
"<li><a href=\"#annotation.type." +
"field.summary\">Field</a>&nbsp;|&nbsp;</li>"},
{ "pkg/AnnotationTypeField.html",
"<li>Detail:&nbsp;</li>\n" +
"<li><a href=\"#annotation.type." +
"field.detail\">Field</a>&nbsp;|&nbsp;</li>"},
{ "pkg/AnnotationTypeField.html",
"<!-- =========== ANNOTATION TYPE FIELD SUMMARY =========== -->"},
{ "pkg/AnnotationTypeField.html",
"<h3>Field Summary</h3>"},
{ "pkg/AnnotationTypeField.html",
"<td class=\"colLast\"><code><span class=\"memberNameLink\"><a href=\"../" +
"pkg/AnnotationTypeField.html#DEFAULT_NAME\">DEFAULT_NAME</a></span>" +
"</code>&nbsp;</td>"},
{ "pkg/AnnotationTypeField.html",
"<!-- ============ ANNOTATION TYPE FIELD DETAIL =========== -->"},
{ "pkg/AnnotationTypeField.html",
"<h4>DEFAULT_NAME</h4>\n" +
"<pre>public static final&nbsp;java." +
"lang.String&nbsp;DEFAULT_NAME</pre>"},
{ "pkg/AnnotationType.html",
"<li>Summary:&nbsp;</li>\n" +
"<li>Field&nbsp;|&nbsp;</li>"},
{ "pkg/AnnotationType.html",
"<li>Detail:&nbsp;</li>\n" +
"<li>Field&nbsp;|&nbsp;</li>"},
};
private static final String[][] NEGATED_TEST = {
{ "pkg/AnnotationType.html",
"<HR>\n\n" +
"<P>\n\n" +
"<P>" +
"<!-- ========= END OF CLASS DATA ========= -->" + "<HR>"}
};
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
public static void main(String... args) throws Exception {
TestAnnotationTypes tester = new TestAnnotationTypes();
tester.run(ARGS, TEST, NEGATED_TEST);
tester.printSummary();
tester.runTests();
}
@Test
void test() {
javadoc("-d", "out",
"-sourcepath", testSrc,
"pkg");
checkExit(Exit.OK);
checkOutput("pkg/AnnotationTypeField.html", true,
"<li>Summary:&nbsp;</li>\n"
+ "<li><a href=\"#annotation.type."
+ "field.summary\">Field</a>&nbsp;|&nbsp;</li>",
"<li>Detail:&nbsp;</li>\n"
+ "<li><a href=\"#annotation.type."
+ "field.detail\">Field</a>&nbsp;|&nbsp;</li>",
"<!-- =========== ANNOTATION TYPE FIELD SUMMARY =========== -->",
"<h3>Field Summary</h3>",
"<td class=\"colLast\"><code><span class=\"memberNameLink\"><a href=\"../"
+ "pkg/AnnotationTypeField.html#DEFAULT_NAME\">DEFAULT_NAME</a></span>"
+ "</code>&nbsp;</td>",
"<!-- ============ ANNOTATION TYPE FIELD DETAIL =========== -->",
"<h4>DEFAULT_NAME</h4>\n"
+ "<pre>public static final&nbsp;java."
+ "lang.String&nbsp;DEFAULT_NAME</pre>");
checkOutput("pkg/AnnotationType.html", true,
"<li>Summary:&nbsp;</li>\n"
+ "<li>Field&nbsp;|&nbsp;</li>",
"<li>Detail:&nbsp;</li>\n"
+ "<li>Field&nbsp;|&nbsp;</li>");
checkOutput("pkg/AnnotationType.html", false,
"<HR>\n\n"
+ "<P>\n\n"
+ "<P>"
+ "<!-- ========= END OF CLASS DATA ========= -->" + "<HR>");
}
}

View file

@ -27,28 +27,27 @@
* @summary Test to make sure that the link to source documentation
* has a forward slash. It would be wrong to use a back slash.
* @author jamieh
* @library ../lib/
* @library ../lib
* @build JavadocTester
* @build TestBackSlashInLink
* @run main TestBackSlashInLink
*/
public class TestBackSlashInLink extends JavadocTester {
private static final String[][] TEST = {
{ "C.html", "src-html/C.html#line.7"}};
private static final String[] ARGS =
new String[] {
"-d", OUTPUT_DIR, "-sourcepath", SRC_DIR,
"-linksource", SRC_DIR + "/C.java"};
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
public static void main(String... args) throws Exception {
TestBackSlashInLink tester = new TestBackSlashInLink();
tester.run(ARGS, TEST, NO_TEST);
tester.printSummary();
tester.runTests();
}
@Test
void test() {
javadoc("-d", "out",
"-sourcepath", testSrc,
"-linksource",
testSrc("C.java"));
checkExit(Exit.OK);
checkOutput("C.html", true,
"src-html/C.html#line.7");
}
}

View file

@ -27,33 +27,27 @@
* @summary Test to make sure that Javadoc emits a useful warning
* when a bad package.html file is in the JAR.
* @author jamieh
* @library ../lib/
* @library ../lib
* @build JavadocTester
* @build TestBadPackageFileInJar
* @run main TestBadPackageFileInJar
*/
public class TestBadPackageFileInJar extends JavadocTester {
private static final String[][] TEST =
new String[][] {
{ERROR_OUTPUT,
"badPackageFileInJar.jar" + FS + "pkg/package.html: error - Body tag missing from HTML"}
};
private static final String[] ARGS =
new String[] {
"-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "-classpath",
SRC_DIR + "/badPackageFileInJar.jar", "pkg"};
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
public static void main(String... args) throws Exception {
TestBadPackageFileInJar tester = new TestBadPackageFileInJar();
tester.run(ARGS, TEST, NO_TEST);
tester.printSummary();
tester.runTests();
}
@Test
void test() {
javadoc("-d", "out",
"-sourcepath", testSrc,
"-classpath", testSrc("badPackageFileInJar.jar"),
"pkg");
checkExit(Exit.FAILED);
checkOutput(Output.ERROR, true,
"badPackageFileInJar.jar" + FS + "pkg/package.html: error - Body tag missing from HTML");
}
}

View file

@ -27,27 +27,28 @@
* @summary Make sure exception is not thrown if there is a bad source
* file in the same directory as the file being documented.
* @author jamieh
* @library ../lib/
* @library ../lib
* @build JavadocTester
* @build TestBadSourceFile
* @run main TestBadSourceFile
*/
public class TestBadSourceFile extends JavadocTester {
//Javadoc arguments.
private static final String[] ARGS = new String[] {
"-Xdoclint:none", "-d", OUTPUT_DIR, SRC_DIR + "/C2.java"
};
/**
* The entry point of the test.
* @param args the array of command line arguments.
* @param args the array of command line arguments
* @throws Exception if the test fails
*/
public static void main(String[] args) {
public static void main(String... args) throws Exception {
TestBadSourceFile tester = new TestBadSourceFile();
int exitCode = tester.run(ARGS, NO_TEST, NO_TEST);
tester.checkExitCode(0, exitCode);
tester.printSummary();
tester.runTests();
}
@Test
void test() {
javadoc("-Xdoclint:none",
"-d", "out",
testSrc("C2.java"));
checkExit(Exit.OK);
}
}

View file

@ -26,29 +26,25 @@
* @bug 4197513
* @summary Javadoc does not process base class.
* @author jamieh
* @library ../lib/
* @library ../lib
* @build BaseClass
* @build JavadocTester
* @build TestBaseClass
* @run main TestBaseClass
*/
public class TestBaseClass extends JavadocTester {
private static final String[] ARGS =
new String[] {
"-sourcepath", SRC_DIR,
"-docletpath", SRC_DIR, "-doclet", "BaseClass",
SRC_DIR + "/Bar.java", "baz"};
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
public static void main(String... args) throws Exception {
TestBaseClass tester = new TestBaseClass();
if (tester.run(ARGS, NO_TEST, NO_TEST) != 0) {
throw new Error("Javadoc failed to execute.");
}
tester.runTests();
}
@Test
void test() {
javadoc("-sourcepath", testSrc,
"-docletpath", testSrc,
"-doclet", "BaseClass",
testSrc("Bar.java"), "baz");
checkExit(Exit.OK);
}
}

View file

@ -29,29 +29,27 @@
* Correct Answer: "The class is empty (i.e. it has no members)."
* Wrong Answer: "The class is empty (i.e."
* @author jamieh
* @library ../lib/
* @library ../lib
* @build JavadocTester
* @build TestBreakIterator
* @run main TestBreakIterator
*/
public class TestBreakIterator extends JavadocTester {
private static final String[][] TEST = {
{ "pkg/BreakIteratorTest.html",
"The class is empty (i.e. it has no members)."}};
private static final String[] ARGS =
new String[] {
"-d", OUTPUT_DIR, "-sourcepath", SRC_DIR,
"-breakiterator", "pkg"};
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
public static void main(String... args) throws Exception {
TestBreakIterator tester = new TestBreakIterator();
tester.run(ARGS, TEST, NO_TEST);
tester.printSummary();
tester.runTests();
}
@Test
void test() {
javadoc("-d", "out",
"-sourcepath", testSrc,
"-breakiterator",
"pkg");
checkExit(Exit.OK);
checkOutput("pkg/BreakIteratorTest.html", true,
"The class is empty (i.e. it has no members).");
}
}

View file

@ -26,9 +26,8 @@
* @bug 4979486
* @summary Make sure tool parses CR line separators properly.
* @author jamieh
* @library ../lib/
* @library ../lib
* @build JavadocTester
* @build TestCRLineSeparator
* @run main TestCRLineSeparator
*/
@ -37,32 +36,27 @@ import java.util.*;
public class TestCRLineSeparator extends JavadocTester {
//Javadoc arguments.
private static final String[] ARGS = new String[] {
"-d", OUTPUT_DIR, "-sourcepath", ".", "pkg"
};
//Input for string search tests.
private static final String[][] TEST = {
{ "pkg/MyClass.html", "Line 1\n" +
" Line 2"}
};
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) throws Exception {
initFiles(new File(SRC_DIR), new File("."), "pkg");
public static void main(String... args) throws Exception {
TestCRLineSeparator tester = new TestCRLineSeparator();
tester.run(ARGS, TEST, NO_TEST);
tester.printSummary();
tester.runTests();
}
@Test
void test() throws IOException {
initFiles(new File(testSrc), new File("src"), "pkg");
javadoc("-d", "out",
"-sourcepath", "src",
"pkg");
checkExit(Exit.OK);
checkOutput("pkg/MyClass.html", true,
"Line 1\n"
+ " Line 2");
}
// recursively copy files from fromDir to toDir, replacing newlines
// with \r
static void initFiles(File fromDir, File toDir, String f) throws IOException {
void initFiles(File fromDir, File toDir, String f) throws IOException {
File from_f = new File(fromDir, f);
File to_f = new File(toDir, f);
if (from_f.isDirectory()) {
@ -71,23 +65,17 @@ public class TestCRLineSeparator extends JavadocTester {
initFiles(from_f, to_f, child);
}
} else {
List<String> lines = new ArrayList<String>();
BufferedReader in = new BufferedReader(new FileReader(from_f));
try {
List<String> lines = new ArrayList<>();
try (BufferedReader in = new BufferedReader(new FileReader(from_f))) {
String line;
while ((line = in.readLine()) != null)
lines.add(line);
} finally {
in.close();
}
BufferedWriter out = new BufferedWriter(new FileWriter(to_f));
try {
try (BufferedWriter out = new BufferedWriter(new FileWriter(to_f))) {
for (String line: lines) {
out.write(line);
out.write("\r");
}
} finally {
out.close();
}
}
}

View file

@ -27,39 +27,34 @@
* @summary Run a test on -charset to make sure the charset gets generated as a
* part of the meta tag.
* @author Bhavesh Patel
* @library ../lib/
* @build JavadocTester TestCharset
* @library ../lib
* @build JavadocTester
* @run main TestCharset
*/
public class TestCharset extends JavadocTester {
//Javadoc arguments.
private static final String[] ARGS = new String[] {
"-d", OUTPUT_DIR, "-charset", "UTF-8", "-sourcepath", SRC_DIR, "pkg"
};
private static final String[][] TEST = {
{ "index.html",
"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">"},
{ "pkg/Foo.html",
"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">"}
};
private static final String[][] NEGATED_TEST = {
{ "index.html",
"<meta http-equiv=\"Content-Type\" content=\"text/html\" charset=\"UTF-8\">"},
{ "pkg/Foo.html",
"<meta http-equiv=\"Content-Type\" content=\"text/html\" charset=\"UTF-8\">"}
};
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
public static void main(String... args) throws Exception {
TestCharset tester = new TestCharset();
tester.run(ARGS, TEST, NEGATED_TEST);
tester.printSummary();
tester.runTests();
}
@Test
void test() {
javadoc("-d", "out",
"-charset", "UTF-8",
"-sourcepath", testSrc,
"pkg");
checkExit(Exit.OK);
checkOutput("index.html", true,
"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">");
checkOutput("pkg/Foo.html", true,
"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">");
checkOutput("index.html", false,
"<meta http-equiv=\"Content-Type\" content=\"text/html\" charset=\"UTF-8\">");
checkOutput("pkg/Foo.html", false,
"<meta http-equiv=\"Content-Type\" content=\"text/html\" charset=\"UTF-8\">");
}
}

View file

@ -26,7 +26,7 @@
* @bug 4652655 4857717 8025633 8026567
* @summary This test verifies that class cross references work properly.
* @author jamieh
* @library ../lib/
* @library ../lib
* @build JavadocTester
* @build TestClassCrossReferences
* @run main TestClassCrossReferences
@ -34,37 +34,34 @@
public class TestClassCrossReferences extends JavadocTester {
private static final String[][] TEST = {
{ "C.html",
"<a href=\"http://java.sun.com/j2se/1.4/docs/api/java/math/package-summary.html?is-external=true\"><code>Link to math package</code></a>"},
{ "C.html",
"<a href=\"http://java.sun.com/j2se/1.4/docs/api/javax/swing/text/AbstractDocument.AttributeContext.html?is-external=true\" " +
"title=\"class or interface in javax.swing.text\"><code>Link to AttributeContext innerclass</code></a>"},
{ "C.html",
"<a href=\"http://java.sun.com/j2se/1.4/docs/api/java/math/BigDecimal.html?is-external=true\" " +
"title=\"class or interface in java.math\"><code>Link to external class BigDecimal</code></a>"},
{ "C.html",
"<a href=\"http://java.sun.com/j2se/1.4/docs/api/java/math/BigInteger.html?is-external=true#gcd-java.math.BigInteger-\" " +
"title=\"class or interface in java.math\"><code>Link to external member gcd</code></a>"},
{ "C.html",
"<dl>\n" +
"<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n" +
"<dd><code>toString</code>&nbsp;in class&nbsp;<code>java.lang.Object</code></dd>\n" +
"</dl>"}
};
private static final String[] ARGS =
new String[] {
"-d", OUTPUT_DIR, "-sourcepath", SRC_DIR,
"-linkoffline", "http://java.sun.com/j2se/1.4/docs/api/",
SRC_DIR, SRC_DIR + "/C.java"};
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
public static void main(String... args) throws Exception {
TestClassCrossReferences tester = new TestClassCrossReferences();
tester.run(ARGS, TEST, NO_TEST);
tester.printSummary();
tester.runTests();
}
@Test
void test() {
final String uri = "http://java.sun.com/j2se/1.4/docs/api/";
javadoc("-d", "out",
"-sourcepath", testSrc,
"-linkoffline", uri, testSrc,
testSrc("C.java"));
checkExit(Exit.OK);
checkOutput("C.html", true,
"<a href=\"" + uri + "java/math/package-summary.html?is-external=true\">"
+ "<code>Link to math package</code></a>",
"<a href=\"" + uri + "javax/swing/text/AbstractDocument.AttributeContext.html?is-external=true\" "
+ "title=\"class or interface in javax.swing.text\"><code>Link to AttributeContext innerclass</code></a>",
"<a href=\"" + uri + "java/math/BigDecimal.html?is-external=true\" "
+ "title=\"class or interface in java.math\"><code>Link to external class BigDecimal</code></a>",
"<a href=\"" + uri + "java/math/BigInteger.html?is-external=true#gcd-java.math.BigInteger-\" "
+ "title=\"class or interface in java.math\"><code>Link to external member gcd</code></a>",
"<dl>\n"
+ "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n"
+ "<dd><code>toString</code>&nbsp;in class&nbsp;<code>java.lang.Object</code></dd>\n"
+ "</dl>");
}
}

View file

@ -29,64 +29,52 @@
* Make sure class tree includes heirarchy for enums and annotation
* types.
* @author jamieh
* @library ../lib/
* @library ../lib
* @build JavadocTester
* @build TestClassTree
* @run main TestClassTree
*/
public class TestClassTree extends JavadocTester {
//Javadoc arguments.
private static final String[] ARGS = new String[] {
"-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg"
};
//Input for string search tests.
private static final String[][] TEST = {
{ "pkg/package-tree.html",
"<ul>\n" +
"<li type=\"circle\">pkg.<a href=\"../pkg/ParentClass.html\" " +
"title=\"class in pkg\"><span class=\"typeNameLink\">ParentClass</span></a>"},
{ "pkg/package-tree.html",
"<h2 title=\"Annotation Type Hierarchy\">Annotation Type Hierarchy</h2>\n" +
"<ul>\n" +
"<li type=\"circle\">pkg.<a href=\"../pkg/AnnotationType.html\" " +
"title=\"annotation in pkg\"><span class=\"typeNameLink\">AnnotationType</span></a> " +
"(implements java.lang.annotation.Annotation)</li>\n" +
"</ul>"},
{ "pkg/package-tree.html",
"<h2 title=\"Enum Hierarchy\">Enum Hierarchy</h2>\n" +
"<ul>\n" +
"<li type=\"circle\">java.lang.Object\n" +
"<ul>\n" +
"<li type=\"circle\">java.lang.Enum&lt;E&gt; (implements java.lang." +
"Comparable&lt;T&gt;, java.io.Serializable)\n" +
"<ul>\n" +
"<li type=\"circle\">pkg.<a href=\"../pkg/Coin.html\" " +
"title=\"enum in pkg\"><span class=\"typeNameLink\">Coin</span></a></li>\n" +
"</ul>\n" +
"</li>\n" +
"</ul>\n" +
"</li>\n" +
"</ul>"
},
};
private static final String[][] NEGATED_TEST = {
{ "pkg/package-tree.html",
"<li type=\"circle\">class pkg.<a href=\"../pkg/ParentClass.html\" " +
"title=\"class in pkg\"><span class=\"typeNameLink\">ParentClass</span></a></li>"}
};
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
public static void main(String... args) throws Exception {
TestClassTree tester = new TestClassTree();
tester.run(ARGS, TEST, NEGATED_TEST);
tester.printSummary();
tester.runTests();
}
@Test
void test() {
javadoc("-d", "out",
"-sourcepath", testSrc,
"pkg");
checkExit(Exit.OK);
checkOutput("pkg/package-tree.html", true,
"<ul>\n"
+ "<li type=\"circle\">pkg.<a href=\"../pkg/ParentClass.html\" "
+ "title=\"class in pkg\"><span class=\"typeNameLink\">ParentClass</span></a>",
"<h2 title=\"Annotation Type Hierarchy\">Annotation Type Hierarchy</h2>\n"
+ "<ul>\n"
+ "<li type=\"circle\">pkg.<a href=\"../pkg/AnnotationType.html\" "
+ "title=\"annotation in pkg\"><span class=\"typeNameLink\">AnnotationType</span></a> "
+ "(implements java.lang.annotation.Annotation)</li>\n"
+ "</ul>",
"<h2 title=\"Enum Hierarchy\">Enum Hierarchy</h2>\n"
+ "<ul>\n"
+ "<li type=\"circle\">java.lang.Object\n"
+ "<ul>\n"
+ "<li type=\"circle\">java.lang.Enum&lt;E&gt; (implements java.lang."
+ "Comparable&lt;T&gt;, java.io.Serializable)\n"
+ "<ul>\n"
+ "<li type=\"circle\">pkg.<a href=\"../pkg/Coin.html\" "
+ "title=\"enum in pkg\"><span class=\"typeNameLink\">Coin</span></a></li>\n"
+ "</ul>\n"
+ "</li>\n"
+ "</ul>\n"
+ "</li>\n"
+ "</ul>");
checkOutput("pkg/package-tree.html", false,
"<li type=\"circle\">class pkg.<a href=\"../pkg/ParentClass.html\" "
+ "title=\"class in pkg\"><span class=\"typeNameLink\">ParentClass</span></a></li>");
}
}

View file

@ -28,47 +28,44 @@
* when specifying packages on the command line and specifying individual
* classes.
* @author jamieh
* @library ../lib/
* @library ../lib
* @build JavadocTester
* @build TestCmndLineClass
* @run main TestCmndLineClass
*/
public class TestCmndLineClass extends JavadocTester {
private static final String OUTPUT_DIR1 = "4506980-tmp1";
private static final String OUTPUT_DIR2 = "4506980-tmp2";
private static final String[] ARGS1 =
new String[] {
"-d", OUTPUT_DIR1, "-sourcepath", SRC_DIR,
"-notimestamp", SRC_DIR + "/C5.java", "pkg1", "pkg2"
};
private static final String[] ARGS2 =
new String[] {
"-d", OUTPUT_DIR2, "-sourcepath", SRC_DIR,
"-notimestamp", SRC_DIR + "/C5.java",
SRC_DIR + "/pkg1/C1.java",
SRC_DIR + "/pkg1/C2.java",
SRC_DIR + "/pkg2/C3.java",
SRC_DIR + "/pkg2/C4.java"
};
private static final String[] FILES_TO_DIFF = {
public static void main(String... args) throws Exception {
TestCmndLineClass tester = new TestCmndLineClass();
tester.runTests();
}
@Test
void test() {
String outdir1 = "out-1";
String outdir2 = "out-2";
javadoc("-d", outdir1,
"-sourcepath", testSrc,
"-notimestamp",
testSrc("C5.java"), "pkg1", "pkg2");
checkExit(Exit.OK);
javadoc("-d", outdir2,
"-sourcepath", testSrc,
"-notimestamp",
testSrc("C5.java"),
testSrc("pkg1/C1.java"),
testSrc("pkg1/C2.java"),
testSrc("pkg2/C3.java"),
testSrc("pkg2/C4.java"));
checkExit(Exit.OK);
diff(outdir1, outdir2,
"C5.html",
"pkg1/C1.html",
"pkg1/C2.html",
"pkg2/C3.html",
"pkg2/C4.html"
};
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
TestCmndLineClass tester = new TestCmndLineClass();
tester.run(ARGS1, NO_TEST, NO_TEST);
tester.run(ARGS2, NO_TEST, NO_TEST);
tester.runDiffs(OUTPUT_DIR1, OUTPUT_DIR2, FILES_TO_DIFF);
"pkg2/C4.html");
}
}

View file

@ -26,32 +26,28 @@
* @bug 8027977
* @summary Test to verify javadoc executes without CompletionFailure exception.
* @author Bhavesh Patel
* @library ../lib/
* @build JavadocTester TestCompletionFailure
* @library ../lib
* @build JavadocTester
* @run main TestCompletionFailure
*/
public class TestCompletionFailure extends JavadocTester {
//Input for string search tests.
private static final String[][] NEGATED_TEST = {
{ERROR_OUTPUT, "TestCompletionFailure: error - " +
"com.sun.tools.javac.code.Symbol$CompletionFailure: class file for " +
"sun.util.locale.provider.LocaleProviderAdapter not found"
}
};
private static final String[] ARGS = new String[] {
"-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg1"
};
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) throws Exception {
public static void main(String... args) throws Exception {
TestCompletionFailure tester = new TestCompletionFailure();
tester.run(ARGS, NO_TEST, NEGATED_TEST);
tester.printSummary();
tester.runTests();
}
@Test
void test() {
javadoc("-d", "out",
"-sourcepath", testSrc,
"pkg1");
checkExit(Exit.OK);
checkOutput(Output.STDERR, false,
"TestCompletionFailure: error - "
+ "com.sun.tools.javac.code.Symbol$CompletionFailure: class file for "
+ "sun.util.locale.provider.LocaleProviderAdapter not found");
}
}

View file

@ -27,28 +27,26 @@
* @summary Test to make sure that constant values page does not get
* generated when doclet has nothing to document.
* @author jamieh
* @library ../lib/
* @library ../lib
* @build JavadocTester
* @build TestConstantValuesPage
* @run main TestConstantValuesPage
*/
public class TestConstantValuesPage extends JavadocTester {
private static final String[][] NEGATED_TEST = {
{NOTICE_OUTPUT, "constant-values.html..."}
};
private static final String[] ARGS =
new String[] {
"-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "foo"};
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
public static void main(String... args) throws Exception {
TestConstantValuesPage tester = new TestConstantValuesPage();
tester.run(ARGS, NO_TEST, NEGATED_TEST);
tester.printSummary();
tester.runTests();
}
@Test
void test() {
javadoc("-d", "out",
"-sourcepath", testSrc,
"foo");
checkExit(Exit.FAILED);
checkOutput(Output.NOTICE, false,
"constant-values.html...");
}
}

View file

@ -27,37 +27,31 @@
* @summary The constructor comments should be surrounded by
* <dl></dl>. Check for this in the output.
* @author jamieh
* @library ../lib/
* @library ../lib
* @build JavadocTester
* @build TestConstructorIndent
* @run main TestConstructorIndent
*/
public class TestConstructorIndent extends JavadocTester {
//Javadoc arguments.
private static final String[] ARGS = new String[] {
"-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, SRC_DIR + "/C.java"
};
//Input for string search tests.
private static final String[][] TEST = {
{ "C.html", "<div class=\"block\">" +
"This is just a simple constructor.</div>\n" +
"<dl>\n" +
"<dt><span class=\"paramLabel\">Parameters:</span></dt>\n" +
"<dd><code>i</code> - a param.</dd>\n" +
"</dl>"
}
};
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
public static void main(String... args) throws Exception {
TestConstructorIndent tester = new TestConstructorIndent();
tester.run(ARGS, TEST, NO_TEST);
tester.printSummary();
tester.runTests();
}
@Test
void test() {
javadoc("-d", "out",
"-sourcepath", testSrc,
testSrc("C.java"));
checkExit(Exit.OK);
checkOutput("C.html", true,
"<div class=\"block\">"
+ "This is just a simple constructor.</div>\n"
+ "<dl>\n"
+ "<dt><span class=\"paramLabel\">Parameters:</span></dt>\n"
+ "<dd><code>i</code> - a param.</dd>\n"
+ "</dl>");
}
}

View file

@ -26,106 +26,66 @@
* @bug 8025524 8031625
* @summary Test for constructor name which should be a non-qualified name.
* @author Bhavesh Patel
* @library ../lib/
* @build JavadocTester TestConstructors
* @library ../lib
* @build JavadocTester
* @run main TestConstructors
*/
public class TestConstructors extends JavadocTester {
//Input for string search tests.
private static final String[][] TEST = {
{ "pkg1/Outer.html",
"<dt><span class=\"seeLabel\">See Also:</span></dt>\n" +
"<dd><a href=\"../pkg1/Outer.Inner.html#Inner--\"><code>Inner()</code></a>, \n" +
"<a href=\"../pkg1/Outer.Inner.html#Inner-int-\"><code>Inner(int)</code></a>, \n" +
"<a href=\"../pkg1/Outer.Inner.NestedInner.html#NestedInner--\"><code>NestedInner()</code></a>, \n" +
"<a href=\"../pkg1/Outer.Inner.NestedInner.html#NestedInner-int-\"><code>NestedInner(int)</code></a>, \n" +
"<a href=\"../pkg1/Outer.html#Outer--\"><code>Outer()</code></a>, \n" +
"<a href=\"../pkg1/Outer.html#Outer-int-\"><code>Outer(int)</code></a>"
},
{ "pkg1/Outer.html",
"Link: <a href=\"../pkg1/Outer.Inner.html#Inner--\"><code>Inner()</code></a>, " +
"<a href=\"../pkg1/Outer.html#Outer-int-\"><code>Outer(int)</code></a>, " +
"<a href=\"../pkg1/Outer.Inner.NestedInner.html#NestedInner-int-\"><code>" +
"NestedInner(int)</code></a>"
},
{ "pkg1/Outer.html",
"<a href=\"../pkg1/Outer.html#Outer--\">Outer</a></span>()"
},
{ "pkg1/Outer.html",
"<a name=\"Outer--\">"
},
{ "pkg1/Outer.html",
"<a href=\"../pkg1/Outer.html#Outer-int-\">Outer</a></span>(int&nbsp;i)"
},
{ "pkg1/Outer.html",
"<a name=\"Outer-int-\">"
},
{ "pkg1/Outer.Inner.html",
"<a href=\"../pkg1/Outer.Inner.html#Inner--\">Inner</a></span>()"
},
{ "pkg1/Outer.Inner.html",
"<a name=\"Inner--\">"
},
{ "pkg1/Outer.Inner.html",
"<a href=\"../pkg1/Outer.Inner.html#Inner-int-\">Inner</a></span>(int&nbsp;i)"
},
{ "pkg1/Outer.Inner.html",
"<a name=\"Inner-int-\">"
},
{ "pkg1/Outer.Inner.NestedInner.html",
"<a href=\"../pkg1/Outer.Inner.NestedInner.html#NestedInner--\">NestedInner</a></span>()"
},
{ "pkg1/Outer.Inner.NestedInner.html",
"<a name=\"NestedInner--\">"
},
{ "pkg1/Outer.Inner.NestedInner.html",
"<a href=\"../pkg1/Outer.Inner.NestedInner.html#NestedInner-int-\">NestedInner</a></span>(int&nbsp;i)"
},
{ "pkg1/Outer.Inner.NestedInner.html",
"<a name=\"NestedInner-int-\">"
}
};
private static final String[][] NEGATED_TEST = {
{ "pkg1/Outer.Inner.html",
"Outer.Inner--"
},
{ "pkg1/Outer.Inner.html",
"Outer.Inner-int-"
},
{ "pkg1/Outer.Inner.NestedInner.html",
"Outer.Inner.NestedInner--"
},
{ "pkg1/Outer.Inner.NestedInner.html",
"Outer.Inner.NestedInner-int-"
},
{ "pkg1/Outer.html",
"<a href=\"../pkg1/Outer.Inner.html#Outer.Inner--\"><code>Outer.Inner()</code></a>"
},
{ "pkg1/Outer.html",
"<a href=\"../pkg1/Outer.Inner.html#Outer.Inner-int-\"><code>Outer.Inner(int)</code></a>"
},
{ "pkg1/Outer.html",
"<a href=\"../pkg1/Outer.Inner.NestedInner.html#Outer.Inner.NestedInner--\"><code>Outer.Inner.NestedInner()</code></a>"
},
{ "pkg1/Outer.html",
"<a href=\"../pkg1/Outer.Inner.NestedInner.html#Outer.Inner.NestedInner-int-\"><code>Outer.Inner.NestedInner(int)</code></a>"
}
};
private static final String[] ARGS = new String[] {
"-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg1"
};
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) throws Exception {
public static void main(String... args) throws Exception {
TestConstructors tester = new TestConstructors();
tester.run(ARGS, TEST, NEGATED_TEST);
tester.printSummary();
tester.runTests();
}
@Test
void test() {
javadoc("-d", "out",
"-sourcepath", testSrc,
"pkg1");
checkExit(Exit.OK);
checkOutput("pkg1/Outer.html", true,
"<dt><span class=\"seeLabel\">See Also:</span></dt>\n"
+ "<dd><a href=\"../pkg1/Outer.Inner.html#Inner--\"><code>Inner()</code></a>, \n"
+ "<a href=\"../pkg1/Outer.Inner.html#Inner-int-\"><code>Inner(int)</code></a>, \n"
+ "<a href=\"../pkg1/Outer.Inner.NestedInner.html#NestedInner--\"><code>NestedInner()</code></a>, \n"
+ "<a href=\"../pkg1/Outer.Inner.NestedInner.html#NestedInner-int-\"><code>NestedInner(int)</code></a>, \n"
+ "<a href=\"../pkg1/Outer.html#Outer--\"><code>Outer()</code></a>, \n"
+ "<a href=\"../pkg1/Outer.html#Outer-int-\"><code>Outer(int)</code></a>",
"Link: <a href=\"../pkg1/Outer.Inner.html#Inner--\"><code>Inner()</code></a>, "
+ "<a href=\"../pkg1/Outer.html#Outer-int-\"><code>Outer(int)</code></a>, "
+ "<a href=\"../pkg1/Outer.Inner.NestedInner.html#NestedInner-int-\"><code>"
+ "NestedInner(int)</code></a>",
"<a href=\"../pkg1/Outer.html#Outer--\">Outer</a></span>()",
"<a name=\"Outer--\">",
"<a href=\"../pkg1/Outer.html#Outer-int-\">Outer</a></span>(int&nbsp;i)",
"<a name=\"Outer-int-\">");
checkOutput("pkg1/Outer.Inner.html", true,
"<a href=\"../pkg1/Outer.Inner.html#Inner--\">Inner</a></span>()",
"<a name=\"Inner--\">",
"<a href=\"../pkg1/Outer.Inner.html#Inner-int-\">Inner</a></span>(int&nbsp;i)",
"<a name=\"Inner-int-\">");
checkOutput("pkg1/Outer.Inner.NestedInner.html", true,
"<a href=\"../pkg1/Outer.Inner.NestedInner.html#NestedInner--\">NestedInner</a></span>()",
"<a name=\"NestedInner--\">",
"<a href=\"../pkg1/Outer.Inner.NestedInner.html#NestedInner-int-\">NestedInner</a></span>(int&nbsp;i)",
"<a name=\"NestedInner-int-\">");
checkOutput("pkg1/Outer.Inner.html", false,
"Outer.Inner--",
"Outer.Inner-int-");
checkOutput("pkg1/Outer.Inner.NestedInner.html", false,
"Outer.Inner.NestedInner--",
"Outer.Inner.NestedInner-int-");
checkOutput("pkg1/Outer.html", false,
"<a href=\"../pkg1/Outer.Inner.html#Outer.Inner--\"><code>Outer.Inner()</code></a>",
"<a href=\"../pkg1/Outer.Inner.html#Outer.Inner-int-\"><code>Outer.Inner(int)</code></a>",
"<a href=\"../pkg1/Outer.Inner.NestedInner.html#Outer.Inner.NestedInner--\"><code>Outer.Inner.NestedInner()</code></a>",
"<a href=\"../pkg1/Outer.Inner.NestedInner.html#Outer.Inner.NestedInner-int-\"><code>Outer.Inner.NestedInner(int)</code></a>");
}
}

View file

@ -26,69 +26,67 @@
* @bug 8006248
* @summary Test custom tag. Verify that an unknown tag generates appropriate warnings.
* @author Bhavesh Patel
* @library ../lib/
* @build JavadocTester taglets.CustomTag TestCustomTag
* @library ../lib
* @build JavadocTester taglets.CustomTag
* @run main TestCustomTag
*/
public class TestCustomTag extends JavadocTester {
//Javadoc arguments.
private static final String[] ARGS = new String[] {
"-Xdoclint:none", "-d", OUTPUT_DIR, "-tagletpath", SRC_DIR,
"-taglet", "taglets.CustomTag", "-sourcepath",
SRC_DIR, SRC_DIR + "/TagTestClass.java"
};
private static final String[] ARGS1 = new String[] {
"-d", OUTPUT_DIR + "-1", "-tagletpath",
SRC_DIR, "-taglet", "taglets.CustomTag",
"-sourcepath", SRC_DIR, SRC_DIR + "/TagTestClass.java"
};
private static final String[] ARGS2 = new String[] {
"-Xdoclint:none", "-d", OUTPUT_DIR + "-2", "-sourcepath",
SRC_DIR, SRC_DIR + "/TagTestClass.java"
};
private static final String[] ARGS3 = new String[] {
"-d", OUTPUT_DIR + "-3", "-sourcepath",
SRC_DIR, SRC_DIR + "/TagTestClass.java"
};
//Input for string search tests.
private static final String[][] TEST = new String[][] {
{WARNING_OUTPUT, "warning - @unknownTag is an unknown tag."
}
};
private static final String[][] TEST1 = new String[][] {
{ERROR_OUTPUT, "error: unknown tag: unknownTag"
}
};
private static final String[][] TEST2 = new String[][] {
{WARNING_OUTPUT, "warning - @customTag is an unknown tag."
},
{WARNING_OUTPUT, "warning - @unknownTag is an unknown tag."
}
};
private static final String[][] TEST3 = new String[][] {
{ERROR_OUTPUT, "error: unknown tag: customTag"
},
{ERROR_OUTPUT, "error: unknown tag: unknownTag"
}
};
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
public static void main(String... args) throws Exception {
TestCustomTag tester = new TestCustomTag();
tester.run(ARGS, TEST, NO_TEST);
tester.run(ARGS1, TEST1, NO_TEST);
tester.run(ARGS2, TEST2, NO_TEST);
tester.run(ARGS3, TEST3, NO_TEST);
tester.printSummary();
tester.runTests();
}
@Test
void test1() {
javadoc("-Xdoclint:none",
"-d", "out-1",
"-tagletpath", testSrc, // TODO: probably useless
"-taglet", "taglets.CustomTag",
"-sourcepath", testSrc,
testSrc("TagTestClass.java"));
checkExit(Exit.OK);
checkOutput(Output.WARNING, true,
"warning - @unknownTag is an unknown tag.");
}
@Test
void test2() {
javadoc("-d", "out-2",
"-tagletpath", testSrc, // TODO: probably useless
"-taglet", "taglets.CustomTag",
"-sourcepath", testSrc,
testSrc("TagTestClass.java"));
checkExit(Exit.FAILED);
checkOutput(Output.ERROR, true,
"error: unknown tag: unknownTag");
}
@Test
void test3() {
javadoc("-Xdoclint:none",
"-d", "out-3",
"-sourcepath", testSrc,
testSrc("TagTestClass.java"));
checkExit(Exit.OK);
checkOutput(Output.WARNING, true,
"warning - @customTag is an unknown tag.",
"warning - @unknownTag is an unknown tag.");
}
@Test
void test4() {
javadoc("-d", "out-4",
"-sourcepath", testSrc,
testSrc("TagTestClass.java"));
checkExit(Exit.FAILED);
checkOutput(Output.ERROR, true,
"error: unknown tag: customTag",
"error: unknown tag: unknownTag");
}
}

View file

@ -26,76 +26,65 @@
* @bug 4927552 8026567
* @summary <DESC>
* @author jamieh
* @library ../lib/
* @build JavadocTester TestDeprecatedDocs
* @library ../lib
* @build JavadocTester
* @run main TestDeprecatedDocs
*/
public class TestDeprecatedDocs extends JavadocTester {
//Javadoc arguments.
private static final String[] ARGS = new String[] {
"-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg"
};
private static final String TARGET_FILE =
"deprecated-list.html";
private static final String TARGET_FILE2 =
"pkg/DeprecatedClassByAnnotation.html";
//Input for string search tests.
private static final String[][] TEST = {
{TARGET_FILE, "annotation_test1 passes"},
{TARGET_FILE, "annotation_test2 passes"},
{TARGET_FILE, "annotation_test3 passes"},
{TARGET_FILE, "class_test1 passes"},
{TARGET_FILE, "class_test2 passes"},
{TARGET_FILE, "class_test3 passes"},
{TARGET_FILE, "class_test4 passes"},
{TARGET_FILE, "enum_test1 passes"},
{TARGET_FILE, "enum_test2 passes"},
{TARGET_FILE, "error_test1 passes"},
{TARGET_FILE, "error_test2 passes"},
{TARGET_FILE, "error_test3 passes"},
{TARGET_FILE, "error_test4 passes"},
{TARGET_FILE, "exception_test1 passes"},
{TARGET_FILE, "exception_test2 passes"},
{TARGET_FILE, "exception_test3 passes"},
{TARGET_FILE, "exception_test4 passes"},
{TARGET_FILE, "interface_test1 passes"},
{TARGET_FILE, "interface_test2 passes"},
{TARGET_FILE, "interface_test3 passes"},
{TARGET_FILE, "interface_test4 passes"},
{TARGET_FILE, "pkg.DeprecatedClassByAnnotation"},
{TARGET_FILE, "pkg.DeprecatedClassByAnnotation()"},
{TARGET_FILE, "pkg.DeprecatedClassByAnnotation.method()"},
{TARGET_FILE, "pkg.DeprecatedClassByAnnotation.field"},
{TARGET_FILE2, "<pre>@Deprecated\n" +
"public class <span class=\"typeNameLabel\">DeprecatedClassByAnnotation</span>\n" +
"extends java.lang.Object</pre>"},
{TARGET_FILE2, "<pre>@Deprecated\n" +
"public&nbsp;int field</pre>\n" +
"<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated.</span>&nbsp;</div>"},
{TARGET_FILE2, "<pre>@Deprecated\n" +
"public&nbsp;DeprecatedClassByAnnotation()</pre>\n" +
"<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated.</span>&nbsp;</div>"},
{TARGET_FILE2, "<pre>@Deprecated\n" +
"public&nbsp;void&nbsp;method()</pre>\n" +
"<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated.</span>&nbsp;</div>"},
};
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
public static void main(String... args) throws Exception {
TestDeprecatedDocs tester = new TestDeprecatedDocs();
tester.run(ARGS, TEST, NO_TEST);
tester.printSummary();
tester.runTests();
}
@Test
void test() {
javadoc("-d", "out",
"-sourcepath", testSrc,
"pkg");
checkExit(Exit.OK);
checkOutput("deprecated-list.html", true,
"annotation_test1 passes",
"annotation_test2 passes",
"annotation_test3 passes",
"class_test1 passes",
"class_test2 passes",
"class_test3 passes",
"class_test4 passes",
"enum_test1 passes",
"enum_test2 passes",
"error_test1 passes",
"error_test2 passes",
"error_test3 passes",
"error_test4 passes",
"exception_test1 passes",
"exception_test2 passes",
"exception_test3 passes",
"exception_test4 passes",
"interface_test1 passes",
"interface_test2 passes",
"interface_test3 passes",
"interface_test4 passes",
"pkg.DeprecatedClassByAnnotation",
"pkg.DeprecatedClassByAnnotation()",
"pkg.DeprecatedClassByAnnotation.method()",
"pkg.DeprecatedClassByAnnotation.field"
);
checkOutput("pkg/DeprecatedClassByAnnotation.html", true,
"<pre>@Deprecated\n"
+ "public class <span class=\"typeNameLabel\">DeprecatedClassByAnnotation</span>\n"
+ "extends java.lang.Object</pre>",
"<pre>@Deprecated\n"
+ "public&nbsp;int field</pre>\n"
+ "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated.</span>&nbsp;</div>",
"<pre>@Deprecated\n"
+ "public&nbsp;DeprecatedClassByAnnotation()</pre>\n"
+ "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated.</span>&nbsp;</div>",
"<pre>@Deprecated\n"
+ "public&nbsp;void&nbsp;method()</pre>\n"
+ "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated.</span>&nbsp;</div>");
}
}

View file

@ -31,36 +31,30 @@
* @summary Run tests on -docencoding to see if the value is
used for stylesheet as well.
* @author jayashree viswanathan
* @library ../lib/
* @build JavadocTester TestDocEncoding
* @library ../lib
* @build JavadocTester
* @run main TestDocEncoding
*/
public class TestDocEncoding extends JavadocTester {
//Javadoc arguments.
private static final String[] ARGS = new String[] {
"-d", OUTPUT_DIR,
"-docencoding", "Cp930",
"-sourcepath", SRC_DIR,
"-notimestamp",
"pkg"
};
private static final String[][] NEGATED_TEST = {
{ "stylesheet.css",
"body {\n" +
" background-color:#ffffff;"}
};
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
public static void main(String... args) throws Exception {
TestDocEncoding tester = new TestDocEncoding();
tester.run(ARGS, NO_TEST, NEGATED_TEST);
tester.printSummary();
tester.runTests();
}
@Test
void test() {
javadoc("-d", "out",
"-docencoding", "Cp930",
"-sourcepath", testSrc,
"-notimestamp",
"pkg");
checkExit(Exit.OK);
checkOutput("stylesheet.css", false,
"body {\n"
+ " background-color:#ffffff;");
}
}

View file

@ -27,31 +27,30 @@
* @summary Make sure that option validation errors and sent to the
* DocErrorReporter.
* @author jamieh
* @library ../lib/
* @library ../lib
* @build JavadocTester
* @build TestDocErrorReporter
* @run main TestDocErrorReporter
*/
public class TestDocErrorReporter extends JavadocTester {
//Javadoc arguments.
private static final String[] ARGS = new String[] {
"-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "-encoding", "xyz",
SRC_DIR + "/TestDocErrorReporter.java"
};
//Input for Javadoc return code test.
private static final int EXPECTED_EXIT_CODE = 1;
/**
* The entry point of the test.
* @param args the array of command line arguments.
* @param args the array of command line arguments
* @throws Exception if the test fails
*/
public static void main(String[] args) {
public static void main(String... args) throws Exception {
TestDocErrorReporter tester = new TestDocErrorReporter();
int actualExitCode = tester.run(ARGS, NO_TEST, NO_TEST);
tester.checkExitCode(EXPECTED_EXIT_CODE, actualExitCode);
tester.printSummary();
tester.runTests();
}
@Test
void test() {
javadoc("-d", "out",
"-sourcepath", testSrc,
"-encoding", "xyz",
testSrc("TestDocErrorReporter.java"));
checkExit(Exit.FAILED);
}
}

View file

@ -21,8 +21,6 @@
* questions.
*/
import java.io.File;
/*
* @test
* @bug 4258405 4973606 8024096
@ -31,68 +29,59 @@ import java.io.File;
* directory.
* Also test that -docfilessubdirs and -excludedocfilessubdir both work.
* @author jamieh
* @library ../lib/
* @library ../lib
* @build JavadocTester
* @build TestDocFileDir
* @run main TestDocFileDir
*/
public class TestDocFileDir extends JavadocTester {
private static final String[][] TEST1 = {
{ "pkg/doc-files/testfile.txt",
"This doc file did not get trashed."}
};
private static final String[] FILE_TEST2 = {
"pkg/doc-files/subdir-used1/testfile.txt",
"pkg/doc-files/subdir-used2/testfile.txt"
};
private static final String[] FILE_NEGATED_TEST2 = {
"pkg/doc-files/subdir-excluded1/testfile.txt",
"pkg/doc-files/subdir-excluded2/testfile.txt"
};
private static final String[][] TEST0 = {
{"pkg/doc-files/testfile.txt",
"This doc file did not get trashed."}
};
//Output dir = Input Dir
private static final String[] ARGS1 =
new String[] {
"-d", OUTPUT_DIR + "-1",
"-sourcepath",
"blah" + File.pathSeparator + OUTPUT_DIR + "-1" +
File.pathSeparator + "blah", "pkg"};
//Exercising -docfilessubdirs and -excludedocfilessubdir
private static final String[] ARGS2 =
new String[] {
"-d", OUTPUT_DIR + "-2",
"-sourcepath", SRC_DIR,
"-docfilessubdirs",
"-excludedocfilessubdir", "subdir-excluded1:subdir-excluded2",
"pkg"};
public static void main(String... args) throws Exception {
TestDocFileDir tester = new TestDocFileDir();
tester.runTests();
}
// Output dir = "", Input dir = ""
private static final String[] ARGS0 =
new String[] {"pkg/C.java"};
@Test
void test1() {
copyDir(testSrc("pkg"), ".");
setOutputDirectoryCheck(DirectoryCheck.NO_HTML_FILES);
javadoc("pkg/C.java");
checkExit(Exit.OK);
checkOutput("pkg/doc-files/testfile.txt", true,
"This doc file did not get trashed.");
}
// Output dir = Input Dir
@Test
void test2() {
String outdir = "out2";
copyDir(testSrc("pkg"), outdir);
setOutputDirectoryCheck(DirectoryCheck.NO_HTML_FILES);
javadoc("-d", outdir,
"-sourcepath", "blah" + PS + outdir + PS + "blah",
"pkg");
checkExit(Exit.OK);
checkOutput("pkg/doc-files/testfile.txt", true,
"This doc file did not get trashed.");
}
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
TestDocFileDir tester = new TestDocFileDir();
tester.setCheckOutputDirectoryCheck(DirectoryCheck.NO_HTML_FILES);
copyDir(SRC_DIR + "/pkg", ".");
tester.run(ARGS0, TEST0, NO_TEST);
copyDir(SRC_DIR + "/pkg", OUTPUT_DIR + "-1");
tester.run(ARGS1, TEST1, NO_TEST);
tester.setCheckOutputDirectoryCheck(DirectoryCheck.NONE);
tester.run(ARGS2, NO_TEST, NO_TEST, FILE_TEST2, FILE_NEGATED_TEST2);
tester.printSummary();
// Exercising -docfilessubdirs and -excludedocfilessubdir
@Test
void test3() {
String outdir = "out3";
setOutputDirectoryCheck(DirectoryCheck.NONE);
javadoc("-d", outdir,
"-sourcepath", testSrc,
"-docfilessubdirs",
"-excludedocfilessubdir", "subdir-excluded1:subdir-excluded2",
"pkg");
checkExit(Exit.OK);
checkFiles(true,
"pkg/doc-files/subdir-used1/testfile.txt",
"pkg/doc-files/subdir-used2/testfile.txt");
checkFiles(false,
"pkg/doc-files/subdir-excluded1/testfile.txt",
"pkg/doc-files/subdir-excluded2/testfile.txt");
}
}

View file

@ -25,28 +25,26 @@
* @test
* @bug 8008949
* @summary verify that doc-files get copied
* @library ../lib/
* @library ../lib
* @build JavadocTester
* @build TestDocFiles
* @run main TestDocFiles
*/
public class TestDocFiles extends JavadocTester {
private static final String[][] TEST = {
{ "pkg/doc-files/test.txt", "test file"}};
private static final String[] ARGS =
new String[] {
"-d", "tmp", "-sourcepath", SRC_DIR, "pkg"};
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
public static void main(String... args) throws Exception {
TestDocFiles tester = new TestDocFiles();
tester.run(ARGS, TEST, NO_TEST);
tester.printSummary();
tester.runTests();
}
@Test
void test() {
javadoc("-d", "out",
"-sourcepath", testSrc,
"pkg");
checkExit(Exit.OK);
checkOutput("pkg/doc-files/test.txt", true,
"test file");
}
}

View file

@ -28,42 +28,38 @@
* If docRoot performs as documented, the test passes.
* Make sure that the docRoot tag works with the -bottom option.
* @author jamieh
* @library ../lib/
* @library ../lib
* @build JavadocTester
* @build TestDocRootInlineTag
* @run main TestDocRootInlineTag
*/
public class TestDocRootInlineTag extends JavadocTester {
private static final String[][] TEST = {
{ "TestDocRootTag.html",
"<a href=\"http://www.java.sun.com/j2se/1.4/docs/api/java/io/File.html?is-external=true\" " +
"title=\"class or interface in java.io\"><code>File</code></a>"},
{ "TestDocRootTag.html",
"<a href=\"./glossary.html\">glossary</a>"},
{ "TestDocRootTag.html",
"<a href=\"http://www.java.sun.com/j2se/1.4/docs/api/java/io/File.html?is-external=true\" " +
"title=\"class or interface in java.io\"><code>Second File Link</code></a>"},
{ "TestDocRootTag.html", "The value of @docRoot is \"./\""},
{ "index-all.html", "My package page is " +
"<a href=\"./pkg/package-summary.html\">here</a>"}
};
private static final String[] ARGS =
new String[] {
"-bottom", "The value of @docRoot is \"{@docRoot}\"",
"-d", OUTPUT_DIR, "-sourcepath", SRC_DIR,
"-linkoffline", "http://www.java.sun.com/j2se/1.4/docs/api",
SRC_DIR, SRC_DIR + "/TestDocRootTag.java", "pkg"
};
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
public static void main(String... args) throws Exception {
TestDocRootInlineTag tester = new TestDocRootInlineTag();
tester.run(ARGS, TEST, NO_TEST);
tester.printSummary();
tester.runTests();
}
@Test
void test() {
String uri = "http://www.java.sun.com/j2se/1.4/docs/api";
javadoc("-bottom", "The value of @docRoot is \"{@docRoot}\"",
"-d", "out",
"-sourcepath", testSrc,
"-linkoffline", uri, testSrc,
testSrc("TestDocRootTag.java"), "pkg");
checkExit(Exit.OK);
checkOutput("TestDocRootTag.html", true,
"<a href=\"" + uri + "/java/io/File.html?is-external=true\" "
+ "title=\"class or interface in java.io\"><code>File</code></a>",
"<a href=\"./glossary.html\">glossary</a>",
"<a href=\"" + uri + "/java/io/File.html?is-external=true\" "
+ "title=\"class or interface in java.io\"><code>Second File Link</code></a>",
"The value of @docRoot is \"./\"");
checkOutput("index-all.html", true,
"My package page is <a href=\"./pkg/package-summary.html\">here</a>");
}
}

View file

@ -26,109 +26,78 @@
* @bug 6553182 8025416 8029504
* @summary This test verifies the -Xdocrootparent option.
* @author Bhavesh Patel
* @library ../lib/
* @build JavadocTester TestDocRootLink
* @library ../lib
* @build JavadocTester
* @run main TestDocRootLink
*/
public class TestDocRootLink extends JavadocTester {
private static final String[][] TEST1 = {
{ "pkg1/C1.html",
"Refer <a href=\"../../technotes/guides/index.html\">Here</a>"
},
{ "pkg1/C1.html",
"This <a href=\"../pkg2/C2.html\">Here</a> should not be replaced\n" +
" with an absolute link."
},
{ "pkg1/C1.html",
"Testing <a href=\"../technotes/guides/index.html\">Link 1</a> and\n" +
" <a href=\"../pkg2/C2.html\">Link 2</a>."
},
{ "pkg1/package-summary.html",
"<a href=\"../../technotes/guides/index.html\">\n" +
" Test document 1</a>"
},
{ "pkg1/package-summary.html",
"<a href=\"../pkg2/C2.html\">\n" +
" Another Test document 1</a>"
},
{ "pkg1/package-summary.html",
"<a href=\"../technotes/guides/index.html\">\n" +
" Another Test document 2.</a>"
}
};
private static final String[][] NEGATED_TEST1 = {
{ "pkg1/C1.html",
"<a href=\"http://download.oracle.com/javase/7/docs/technotes/guides/index.html\">"
},
{ "pkg1/C1.html",
"<a href=\"http://download.oracle.com/javase/7/docs/pkg2/C2.html\">"
},
{ "pkg1/package-summary.html",
"<a href=\"http://download.oracle.com/javase/7/docs/technotes/guides/index.html\">"
},
{ "pkg1/package-summary.html",
"<a href=\"http://download.oracle.com/javase/7/docs/pkg2/C2.html\">"
}
};
private static final String[][] TEST2 = {
{ "pkg2/C2.html",
"Refer <a href=\"http://download.oracle.com/javase/7/docs/technotes/guides/index.html\">Here</a>"
},
{ "pkg2/C2.html",
"This <a href=\"../pkg1/C1.html\">Here</a> should not be replaced\n" +
" with an absolute link."
},
{ "pkg2/C2.html",
"Testing <a href=\"../technotes/guides/index.html\">Link 1</a> and\n" +
" <a href=\"../pkg1/C1.html\">Link 2</a>."
},
{ "pkg2/package-summary.html",
"<a href=\"http://download.oracle.com/javase/7/docs/technotes/guides/index.html\">\n" +
" Test document 1</a>"
},
{ "pkg2/package-summary.html",
"<a href=\"../pkg1/C1.html\">\n" +
" Another Test document 1</a>"
},
{ "pkg2/package-summary.html",
"<a href=\"../technotes/guides/index.html\">\n" +
" Another Test document 2.</a>"
}
};
private static final String[][] NEGATED_TEST2 = {
{ "pkg2/C2.html",
"<a href=\"../../technotes/guides/index.html\">"
},
{ "pkg2/C2.html",
"<a href=\"http://download.oracle.com/javase/7/docs/pkg1/C1.html\">"
},
{ "pkg2/package-summary.html",
"<a href=\"../../technotes/guides/index.html\">"
},
{ "pkg2/package-summary.html",
"<a href=\"http://download.oracle.com/javase/7/docs/pkg1/C1.html\">"
}
};
private static final String[] ARGS1 =
new String[]{
"-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg1", "pkg2"
};
private static final String[] ARGS2 =
new String[]{
"-d", OUTPUT_DIR + "-1", "-Xdocrootparent",
"http://download.oracle.com/javase/7/docs", "-sourcepath",
SRC_DIR, "pkg1", "pkg2"
};
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
public static void main(String... args) throws Exception {
TestDocRootLink tester = new TestDocRootLink();
tester.run(ARGS1, TEST1, NEGATED_TEST1);
tester.run(ARGS2, TEST2, NEGATED_TEST2);
tester.printSummary();
tester.runTests();
}
@Test
void test1() {
javadoc("-d", "out-1",
"-sourcepath", testSrc,
"pkg1", "pkg2");
checkExit(Exit.OK);
checkOutput("pkg1/C1.html", true,
"Refer <a href=\"../../technotes/guides/index.html\">Here</a>",
"This <a href=\"../pkg2/C2.html\">Here</a> should not be replaced\n" +
" with an absolute link.",
"Testing <a href=\"../technotes/guides/index.html\">Link 1</a> and\n" +
" <a href=\"../pkg2/C2.html\">Link 2</a>.");
checkOutput("pkg1/package-summary.html", true,
"<a href=\"../../technotes/guides/index.html\">\n" +
" Test document 1</a>",
"<a href=\"../pkg2/C2.html\">\n" +
" Another Test document 1</a>",
"<a href=\"../technotes/guides/index.html\">\n" +
" Another Test document 2.</a>");
// TODO: should this check *any* reference to http://download.oracle.com/
checkOutput("pkg1/C1.html", false,
"<a href=\"http://download.oracle.com/javase/7/docs/technotes/guides/index.html\">",
"<a href=\"http://download.oracle.com/javase/7/docs/pkg2/C2.html\">");
checkOutput("pkg1/package-summary.html", false,
"<a href=\"http://download.oracle.com/javase/7/docs/technotes/guides/index.html\">",
"<a href=\"http://download.oracle.com/javase/7/docs/pkg2/C2.html\">");
}
@Test
void test2() {
javadoc("-d", "out-2",
"-Xdocrootparent", "http://download.oracle.com/javase/7/docs",
"-sourcepath", testSrc,
"pkg1", "pkg2");
checkExit(Exit.OK);
checkOutput("pkg2/C2.html", true,
"Refer <a href=\"http://download.oracle.com/javase/7/docs/technotes/guides/index.html\">Here</a>",
"This <a href=\"../pkg1/C1.html\">Here</a> should not be replaced\n" +
" with an absolute link.",
"Testing <a href=\"../technotes/guides/index.html\">Link 1</a> and\n" +
" <a href=\"../pkg1/C1.html\">Link 2</a>.");
checkOutput("pkg2/package-summary.html", true,
"<a href=\"http://download.oracle.com/javase/7/docs/technotes/guides/index.html\">\n" +
" Test document 1</a>",
"<a href=\"../pkg1/C1.html\">\n" +
" Another Test document 1</a>",
"<a href=\"../technotes/guides/index.html\">\n" +
" Another Test document 2.</a>");
checkOutput("pkg2/C2.html", false,
"<a href=\"../../technotes/guides/index.html\">",
"<a href=\"http://download.oracle.com/javase/7/docs/pkg1/C1.html\">");
checkOutput("pkg2/package-summary.html", false,
"<a href=\"../../technotes/guides/index.html\">",
"<a href=\"http://download.oracle.com/javase/7/docs/pkg1/C1.html\">");
}
}

View file

@ -27,28 +27,26 @@
* @summary Test to ensure that the doclet does not print out bad
* warning messages about duplicate param tags.
* @author jamieh
* @library ../lib/
* @library ../lib
* @build JavadocTester
* @build TestDupParamWarn
* @run main TestDupParamWarn
*/
public class TestDupParamWarn extends JavadocTester {
private static final String[] ARGS =
new String[] {"-d", OUTPUT_DIR, "-sourcepath",
SRC_DIR + "/", "pkg"};
private static final String[][] NEGATED_TEST =
new String[][] {{WARNING_OUTPUT,
"Parameter \"a\" is documented more than once."}};
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
public static void main(String... args) throws Exception {
JavadocTester tester = new TestDupParamWarn();
tester.run(ARGS, NO_TEST, NEGATED_TEST);
tester.printSummary();
tester.runTests();
}
@Test
void test() {
javadoc("-d", "out",
"-sourcepath", testSrc,
"pkg");
checkExit(Exit.OK);
checkOutput(Output.WARNING, false,
"Parameter \"a\" is documented more than once.");
}
}

View file

@ -27,39 +27,32 @@
* @summary Test to make sure that Javadoc behaves properly when
* run on a completely empty class (no comments or members).
* @author jamieh
* @library ../lib/
* @library ../lib
* @build JavadocTester
* @build TestEmptyClass
* @run main TestEmptyClass
*/
public class TestEmptyClass extends JavadocTester {
private static final String[][] NEGATED_TEST = {
public static void main(String... args) throws Exception {
TestEmptyClass tester = new TestEmptyClass();
tester.runTests();
}
@Test
void test() {
javadoc("-classpath", testSrc("src"),
"-d", "out",
"-sourcepath", testSrc("src"),
testSrc("src/Empty.java"));
checkExit(Exit.OK);
//The overview tree should not link to classes that were not documented
{ "overview-tree.html", "<A HREF=\"TestEmptyClass.html\">"},
checkOutput("overview-tree.html", false,
"<A HREF=\"TestEmptyClass.html\">");
//The index page should not link to classes that were not documented
{ "index-all.html", "<A HREF=\"TestEmptyClass.html\">"},
};
private static final String[] ARGS =
new String[] {
"-classpath", SRC_DIR + "/src",
"-d", OUTPUT_DIR, "-sourcepath", SRC_DIR + "/src",
SRC_DIR + "/src/Empty.java"
};
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
TestEmptyClass tester = new TestEmptyClass();
int exitCode = tester.run(ARGS, NO_TEST, NEGATED_TEST);
tester.printSummary();
if (exitCode != 0) {
throw new Error("Error found while executing Javadoc");
}
checkOutput("index-all.html", false,
"<A HREF=\"TestEmptyClass.html\">");
}
}

View file

@ -26,31 +26,26 @@
* @bug 5008230
* @summary Check the outer class when documenting enclosing class/interface.
* @author jamieh
* @library ../lib/
* @library ../lib
* @build JavadocTester
* @build TestEnclosingClass
* @run main TestEnclosingClass
*/
public class TestEnclosingClass extends JavadocTester {
//Javadoc arguments.
private static final String[] ARGS = new String[] {
"-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg"
};
//Input for string search tests.
private static final String[][] TEST = {
{ "pkg/MyClass.MyInterface.html", "Enclosing class:"}
};
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
public static void main(String... args) throws Exception {
TestEnclosingClass tester = new TestEnclosingClass();
tester.run(ARGS, TEST, NO_TEST);
tester.printSummary();
tester.runTests();
}
@Test
void test() {
javadoc("-d", "out",
"-sourcepath", testSrc,
"pkg");
checkExit(Exit.OK);
checkOutput("pkg/MyClass.MyInterface.html", true,
"Enclosing class:");
}
}

View file

@ -27,32 +27,28 @@
* @summary This test determines if the value of the -encoding option is
* properly passed from Javadoc to the source file parser.
* @author jamieh
* @library ../lib/
* @library ../lib
* @build JavadocTester
* @build TestEncoding
* @run main TestEncoding
*/
public class TestEncoding extends JavadocTester {
public static void main(String... args) throws Exception {
TestEncoding tester = new TestEncoding();
tester.runTests();
}
@Test
void test() {
javadoc("-d", "out",
"-sourcepath", testSrc,
"-encoding", "iso-8859-1",
testSrc("EncodeTest.java"));
checkExit(Exit.OK);
// If ??? is found in the output, the source file was not read with the correct encoding setting.
private static final String[][] NEGATED_TEST = {
{ "EncodeTest.html", "??"}
};
private static final String[] ARGS =
new String[] {
"-d", OUTPUT_DIR, "-sourcepath", SRC_DIR,
"-encoding", "iso-8859-1", SRC_DIR + "/EncodeTest.java"
};
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
TestEncoding tester = new TestEncoding();
tester.run(ARGS, NO_TEST, NEGATED_TEST);
tester.printSummary();
checkOutput("EncodeTest.html", false,
"??");
}
}

View file

@ -28,41 +28,38 @@
* are documented properly. The method should still include "implements" or
* "overrides" documentation even though the method is external.
* @author jamieh
* @library ../lib/
* @library ../lib
* @build JavadocTester TestExternalOverridenMethod
* @run main TestExternalOverridenMethod
*/
public class TestExternalOverridenMethod extends JavadocTester {
private static final String[][] TEST = {
{ "pkg/XReader.html",
"<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n" +
"<dd><code><a href=\"http://java.sun.com/j2se/1.4.1/docs/api/java/io/FilterReader.html?is-external=true#read--\" " +
"title=\"class or interface in java.io\">read</a></code>&nbsp;in class&nbsp;<code>" +
"<a href=\"http://java.sun.com/j2se/1.4.1/docs/api/java/io/FilterReader.html?is-external=true\" " +
"title=\"class or interface in java.io\">FilterReader</a></code></dd>"},
{ "pkg/XReader.html",
"<dt><span class=\"overrideSpecifyLabel\">Specified by:</span></dt>\n" +
"<dd><code><a href=\"http://java.sun.com/j2se/1.4.1/docs/api/java/io/DataInput.html?is-external=true#readInt--\" " +
"title=\"class or interface in java.io\">readInt</a></code>&nbsp;in interface&nbsp;<code>" +
"<a href=\"http://java.sun.com/j2se/1.4.1/docs/api/java/io/DataInput.html?is-external=true\" " +
"title=\"class or interface in java.io\">DataInput</a></code></dd>"}};
private static final String[] ARGS =
new String[] {
"-d", OUTPUT_DIR, "-sourcepath", SRC_DIR,
"-linkoffline", "http://java.sun.com/j2se/1.4.1/docs/api", SRC_DIR,
"pkg"
};
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
public static void main(String... args) throws Exception {
TestExternalOverridenMethod tester = new TestExternalOverridenMethod();
tester.run(ARGS, TEST, NO_TEST);
tester.printSummary();
tester.runTests();
}
@Test
void test() {
String uri = "http://java.sun.com/j2se/1.4.1/docs/api";
javadoc("-d", "out",
"-sourcepath", testSrc,
"-linkoffline", uri, testSrc,
"pkg");
checkExit(Exit.OK);
checkOutput("pkg/XReader.html", true,
"<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n"
+ "<dd><code><a href=\"" + uri + "/java/io/FilterReader.html?is-external=true#read--\" "
+ "title=\"class or interface in java.io\">read</a></code>&nbsp;in class&nbsp;<code>"
+ "<a href=\"" + uri + "/java/io/FilterReader.html?is-external=true\" "
+ "title=\"class or interface in java.io\">FilterReader</a></code></dd>",
"<dt><span class=\"overrideSpecifyLabel\">Specified by:</span></dt>\n"
+ "<dd><code><a href=\"" + uri + "/java/io/DataInput.html?is-external=true#readInt--\" "
+ "title=\"class or interface in java.io\">readInt</a></code>&nbsp;in interface&nbsp;<code>"
+ "<a href=\"" + uri + "/java/io/DataInput.html?is-external=true\" "
+ "title=\"class or interface in java.io\">DataInput</a></code></dd>"
);
}
}

View file

@ -25,14 +25,41 @@
* @test
* @bug 8000418 8024288
* @summary Verify that files use a common Generated By string
* @library ../lib/
* @build JavadocTester TestGeneratedBy
* @library ../lib
* @build JavadocTester
* @run main TestGeneratedBy
*/
public class TestGeneratedBy extends JavadocTester {
private static final String[] FILES = {
public static void main(String... args) throws Exception {
TestGeneratedBy tester = new TestGeneratedBy();
tester.runTests();
}
@Test
void testTimestamp() {
javadoc("-d", "out-timestamp",
"-sourcepath", testSrc,
"pkg");
checkExit(Exit.OK);
checkTimestamps(true);
}
@Test
void testNoTimestamp() {
javadoc("-d", "out-notimestamp",
"-notimestamp",
"-sourcepath", testSrc,
"pkg");
checkExit(Exit.OK);
checkTimestamps(false);
}
void checkTimestamps(boolean timestamp) {
checkTimestamps(timestamp,
"pkg/MyClass.html",
"pkg/package-summary.html",
"pkg/package-frame.html",
@ -45,63 +72,25 @@ public class TestGeneratedBy extends JavadocTester {
"serialized-form.html",
"help-doc.html",
"index-all.html",
"index.html"
};
"index.html");
private static final String[] STD_ARGS =
new String[] {
"-d", OUTPUT_DIR,
"-sourcepath", SRC_DIR,
"pkg"
};
}
private static final String[] NO_TIMESTAMP_ARGS =
new String[] {
"-notimestamp",
"-d", OUTPUT_DIR + "-1",
"-sourcepath", SRC_DIR,
"pkg"
};
private static String[][] getTests(boolean timestamp) {
void checkTimestamps(boolean timestamp, String... files) {
String version = System.getProperty("java.version");
String[][] tests = new String[FILES.length][];
for (int i = 0; i < FILES.length; i++) {
String genBy = "Generated by javadoc";
if (timestamp) genBy += " (" + version + ") on ";
tests[i] = new String[] {
FILES[i], genBy
};
}
return tests;
}
private static String[][] getNegatedTests(boolean timestamp) {
String[][] tests = new String[FILES.length][];
for (int i = 0; i < FILES.length; i++) {
tests[i] = new String[] {
FILES[i],
for (String file: files) {
// genBy is the current standard "Generated by" text
checkOutput(file, true, genBy);
// These are older versions of the "Generated by" text
checkOutput(file, false,
(timestamp
? "Generated by javadoc (version"
: "Generated by javadoc ("),
"Generated by javadoc on"
};
}
return tests;
}
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
TestGeneratedBy tester = new TestGeneratedBy();
int ec1 = tester.run(STD_ARGS, getTests(true), getNegatedTests(true));
int ec2 = tester.run(NO_TIMESTAMP_ARGS, getTests(false), getNegatedTests(false));
tester.printSummary();
if (ec1 != 0 || ec2 != 0) {
throw new Error("Error found while executing Javadoc");
"Generated by javadoc on");
}
}
}

View file

@ -27,49 +27,46 @@
* @summary Test to make sure the -group option does not cause a bad warning
* to be printed.
* @author jamieh
* @library ../lib/
* @library ../lib
* @build JavadocTester
* @build TestGroupOption
* @run main TestGroupOption
*/
public class TestGroupOption extends JavadocTester {
//Javadoc arguments.
private static final String[] ARGS1 = new String[] {
"-d", OUTPUT_DIR, "-sourcepath", SRC_DIR,
public static void main(String... args) throws Exception {
TestGroupOption tester = new TestGroupOption();
tester.runTests();
}
@Test
void test1() {
//Make sure the warning is not printed when -group is used correctly.
javadoc("-d", "out-1",
"-sourcepath", testSrc,
"-group", "Package One", "pkg1",
"-group", "Package Two", "pkg2",
"-group", "Package Three", "pkg3",
"pkg1", "pkg2", "pkg3"
};
"pkg1", "pkg2", "pkg3");
checkExit(Exit.OK);
private static final String[] ARGS2 = new String[] {
"-d", OUTPUT_DIR + "-1", "-sourcepath", SRC_DIR,
checkOutput(Output.WARNING, false,
"-group");
}
@Test
void test2() {
//Make sure the warning is printed when -group is not used correctly.
javadoc("-d", "out-2",
"-sourcepath", testSrc,
"-group", "Package One", "pkg1",
"-group", "Package One", "pkg2",
"-group", "Package One", "pkg3",
"pkg1", "pkg2", "pkg3"
};
"pkg1", "pkg2", "pkg3");
checkExit(Exit.OK);
//Input for string search tests.
private static final String[][] NEGATED_TEST1 = {{WARNING_OUTPUT, "-group"}};
checkOutput(Output.WARNING, true,
"-group");
private static final String[][] TEST2 = {{WARNING_OUTPUT, "-group"}};
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
//Make sure the warning is not printed when -group is used correctly.
TestGroupOption tester = new TestGroupOption();
tester.run(ARGS1, NO_TEST, NEGATED_TEST1);
tester.printSummary();
//Make sure the warning is printed when -group is not used correctly.
tester = new TestGroupOption();
tester.run(ARGS2, TEST2, NO_TEST);
tester.printSummary();
}
}

View file

@ -26,7 +26,7 @@
* @bug 4905786 6259611
* @summary Make sure that headings use the TH tag instead of the TD tag.
* @author jamieh
* @library ../lib/
* @library ../lib
* @build JavadocTester
* @build TestHeadings
* @run main TestHeadings
@ -34,87 +34,82 @@
public class TestHeadings extends JavadocTester {
//Javadoc arguments.
private static final String[] ARGS = new String[] {
"-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "-use", "-header", "Test Files",
"pkg1", "pkg2"
private static final String[][] TEST = {
{
},
{ "serialized-form.html"
},
{ "serialized-form.html"
},
{
},
{ "overview-frame.html"
},
{
}
};
//Input for string search tests.
private static final String[][] TEST = {
public static void main(String... args) throws Exception {
TestHeadings tester = new TestHeadings();
tester.runTests();
}
@Test
void test() {
javadoc("-d", "out",
"-sourcepath", testSrc,
"-use",
"-header", "Test Files",
"pkg1", "pkg2");
checkExit(Exit.OK);
//Package summary
{ "pkg1/package-summary.html",
"<th class=\"colFirst\" scope=\"col\">" +
"Class</th>\n" +
"<th class=\"colLast\" scope=\"col\"" +
">Description</th>"
},
checkOutput("pkg1/package-summary.html", true,
"<th class=\"colFirst\" scope=\"col\">"
+ "Class</th>\n"
+ "<th class=\"colLast\" scope=\"col\""
+ ">Description</th>");
// Class documentation
{ "pkg1/C1.html",
"<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n" +
"<th class=\"colLast\" scope=\"col\">Field and Description</th>"
},
{ "pkg1/C1.html",
"<h3>Methods inherited from class&nbsp;java.lang.Object</h3>"
},
checkOutput("pkg1/C1.html", true,
"<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n"
+ "<th class=\"colLast\" scope=\"col\">Field and Description</th>",
"<h3>Methods inherited from class&nbsp;java.lang.Object</h3>");
// Class use documentation
{ "pkg1/class-use/C1.html",
"<th class=\"colFirst\" scope=\"col\">Package</th>\n" +
"<th class=\"colLast\" scope=\"col\">Description</th>"
},
{ "pkg1/class-use/C1.html",
"<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n" +
"<th class=\"colLast\" scope=\"col\">Field and Description</th>"
},
checkOutput("pkg1/class-use/C1.html", true,
"<th class=\"colFirst\" scope=\"col\">Package</th>\n"
+ "<th class=\"colLast\" scope=\"col\">Description</th>",
"<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n"
+ "<th class=\"colLast\" scope=\"col\">Field and Description</th>");
// Deprecated
{ "deprecated-list.html",
"<th class=\"colOne\" scope=\"col\">Method and Description</th>"
},
checkOutput("deprecated-list.html", true,
"<th class=\"colOne\" scope=\"col\">Method and Description</th>");
// Constant values
{ "constant-values.html",
"<th class=\"colFirst\" scope=\"col\">" +
"Modifier and Type</th>\n" +
"<th scope=\"col\">Constant Field</th>\n" +
"<th class=\"colLast\" scope=\"col\">Value</th>"
},
checkOutput("constant-values.html", true,
"<th class=\"colFirst\" scope=\"col\">"
+ "Modifier and Type</th>\n"
+ "<th scope=\"col\">Constant Field</th>\n"
+ "<th class=\"colLast\" scope=\"col\">Value</th>");
// Serialized Form
{ "serialized-form.html",
"<h2 title=\"Package\">Package&nbsp;pkg1</h2>"
},
{ "serialized-form.html",
"<h3>Class <a href=\"pkg1/C1.html\" title=\"class in pkg1\">" +
"pkg1.C1</a> extends java.lang.Object implements Serializable</h3>"
},
{ "serialized-form.html",
"<h3>Serialized Fields</h3>"
},
checkOutput("serialized-form.html", true,
"<h2 title=\"Package\">Package&nbsp;pkg1</h2>",
"<h3>Class <a href=\"pkg1/C1.html\" title=\"class in pkg1\">"
+ "pkg1.C1</a> extends java.lang.Object implements Serializable</h3>",
"<h3>Serialized Fields</h3>");
// Overview Frame
{ "overview-frame.html",
"<h1 title=\"Test Files\" class=\"bar\">Test Files</h1>"
},
{ "overview-frame.html",
"<title>Overview List</title>"
},
checkOutput("overview-frame.html", true,
"<h1 title=\"Test Files\" class=\"bar\">Test Files</h1>",
"<title>Overview List</title>");
// Overview Summary
{ "overview-summary.html",
"<title>Overview</title>"
}
};
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
TestHeadings tester = new TestHeadings();
tester.run(ARGS, TEST, NO_TEST);
tester.printSummary();
checkOutput("overview-summary.html", true,
"<title>Overview</title>");
}
}

View file

@ -26,32 +26,26 @@
* @bug 7132631
* @summary Make sure that the help file is generated correctly.
* @author Bhavesh Patel
* @library ../lib/
* @build JavadocTester TestHelpFile
* @library ../lib
* @build JavadocTester
* @run main TestHelpFile
*/
public class TestHelpFile extends JavadocTester {
//Javadoc arguments.
private static final String[] ARGS = new String[] {
"-d", OUTPUT_DIR, "-sourcepath", SRC_DIR,
SRC_DIR + "/TestHelpFile.java"
};
private static final String[][] TEST = {
{ "help-doc.html",
"<a href=\"constant-values.html\">Constant Field Values</a>"
},
};
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
public static void main(String... args) throws Exception {
TestHelpFile tester = new TestHelpFile();
tester.run(ARGS, TEST, NO_TEST);
tester.printSummary();
tester.runTests();
}
@Test
void test() {
javadoc("-d", "out",
"-sourcepath", testSrc,
testSrc("TestHelpFile.java"));
checkExit(Exit.OK);
checkOutput("help-doc.html", true,
"<a href=\"constant-values.html\">Constant Field Values</a>");
}
}

View file

@ -27,81 +27,79 @@
* @summary Make sure that the -help option works properly. Make sure
* the help link appears in the documentation.
* @author jamieh
* @library ../lib/
* @library ../lib
* @build JavadocTester TestHelpOption
* @run main TestHelpOption
*/
public class TestHelpOption extends JavadocTester {
//Javadoc arguments.
private static final String[] ARGS = new String[] {
"-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "-help",
SRC_DIR + "/TestHelpOption.java"
};
private static final String[] ARGS2 = new String[] {
"-d", OUTPUT_DIR, "-sourcepath", SRC_DIR,
SRC_DIR + "/TestHelpOption.java"
};
private static final String[][] TEST = {
{STANDARD_OUTPUT, "-d "},
{STANDARD_OUTPUT, "-use "},
{STANDARD_OUTPUT, "-version "},
{STANDARD_OUTPUT, "-author "},
{STANDARD_OUTPUT, "-docfilessubdirs "},
{STANDARD_OUTPUT, "-splitindex "},
{STANDARD_OUTPUT, "-windowtitle "},
{STANDARD_OUTPUT, "-doctitle "},
{STANDARD_OUTPUT, "-header "},
{STANDARD_OUTPUT, "-footer "},
{STANDARD_OUTPUT, "-bottom "},
{STANDARD_OUTPUT, "-link "},
{STANDARD_OUTPUT, "-linkoffline "},
{STANDARD_OUTPUT, "-excludedocfilessubdir "},
{STANDARD_OUTPUT, "-group "},
{STANDARD_OUTPUT, "-nocomment "},
{STANDARD_OUTPUT, "-nodeprecated "},
{STANDARD_OUTPUT, "-noqualifier "},
{STANDARD_OUTPUT, "-nosince "},
{STANDARD_OUTPUT, "-notimestamp "},
{STANDARD_OUTPUT, "-nodeprecatedlist "},
{STANDARD_OUTPUT, "-notree "},
{STANDARD_OUTPUT, "-noindex "},
{STANDARD_OUTPUT, "-nohelp "},
{STANDARD_OUTPUT, "-nonavbar "},
{STANDARD_OUTPUT, "-serialwarn "},
{STANDARD_OUTPUT, "-tag "},
{STANDARD_OUTPUT, "-taglet "},
{STANDARD_OUTPUT, "-tagletpath "},
{STANDARD_OUTPUT, "-charset "},
{STANDARD_OUTPUT, "-helpfile "},
{STANDARD_OUTPUT, "-linksource "},
{STANDARD_OUTPUT, "-sourcetab "},
{STANDARD_OUTPUT, "-keywords "},
{STANDARD_OUTPUT, "-stylesheetfile "},
{STANDARD_OUTPUT, "-docencoding "},
};
private static final String[][] TEST2 = {
{ "TestHelpOption.html",
"<li><a href=\"help-doc.html\">Help</a></li>"
},
};
//The help option should not crash the doclet.
private static final int EXPECTED_EXIT_CODE = 0;
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
public static void main(String... args) throws Exception {
TestHelpOption tester = new TestHelpOption();
int actualExitCode = tester.run(ARGS, TEST, NO_TEST);
tester.checkExitCode(EXPECTED_EXIT_CODE, actualExitCode);
tester.run(ARGS2, TEST2, NO_TEST);
tester.printSummary();
tester.runTests();
}
@Test
void testWithOption() {
javadoc("-d", "out1",
"-sourcepath", testSrc,
"-help",
testSrc("TestHelpOption.java"));
checkExit(Exit.OK);
checkOutput(true);
}
@Test
void testWithoutOption() {
javadoc("-d", "out2",
"-sourcepath", testSrc,
testSrc("TestHelpOption.java"));
checkExit(Exit.OK);
checkOutput(false);
}
private void checkOutput(boolean withOption) {
checkOutput(Output.STDOUT, withOption,
"-d ",
"-use ",
"-version ",
"-author ",
"-docfilessubdirs ",
"-splitindex ",
"-windowtitle ",
"-doctitle ",
"-header ",
"-footer ",
"-bottom ",
"-link ",
"-linkoffline ",
"-excludedocfilessubdir ",
"-group ",
"-nocomment ",
"-nodeprecated ",
"-noqualifier ",
"-nosince ",
"-notimestamp ",
"-nodeprecatedlist ",
"-notree ",
"-noindex ",
"-nohelp ",
"-nonavbar ",
"-serialwarn ",
"-tag ",
"-taglet ",
"-tagletpath ",
"-charset ",
"-helpfile ",
"-linksource ",
"-sourcetab ",
"-keywords ",
"-stylesheetfile ",
"-docencoding ");
checkOutput("TestHelpOption.html", !withOption,
"<li><a href=\"help-doc.html\">Help</a></li>");
}
}

View file

@ -27,34 +27,37 @@
* @summary Test to make sure that hidden overriden members are not
* documented as inherited.
* @author jamieh
* @library ../lib/
* @library ../lib
* @build JavadocTester
* @build TestHiddenMembers
* @run main TestHiddenMembers
*/
public class TestHiddenMembers extends JavadocTester {
//We should not inherit any members from BaseClass because they are all overriden and hidden
//(declared as private).
private static final String[][] NEGATED_TEST = {
{ "pkg/SubClass.html",
"inherited from class pkg.<A HREF=\"../pkg/BaseClass.html\">BaseClass</A>"}
{ }
};
private static final String[] ARGS =
new String[] {
"-d", OUTPUT_DIR, "-sourcepath", SRC_DIR,
"pkg"
};
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
public static void main(String... args) throws Exception {
TestHiddenMembers tester = new TestHiddenMembers();
tester.run(ARGS, NO_TEST, NEGATED_TEST);
tester.printSummary();
tester.runTests();
}
@Test
void test() {
javadoc("-d", "out",
"-sourcepath", testSrc,
"pkg");
checkExit(Exit.OK);
// We should not inherit any members from BaseClass because they are all overriden and hidden
// (declared as private).
// TODO: check normal case of generated tags: upper case of lower case
checkOutput("pkg/SubClass.html", false,
"inherited from class pkg.<A HREF=\"../pkg/BaseClass.html\">BaseClass</A>");
}
}

View file

@ -26,73 +26,57 @@
* @bug 4663254 8016328 8025633 8026567
* @summary Verify that spaces do not appear in hrefs and anchors.
* @author jamieh
* @library ../lib/
* @build JavadocTester TestHref
* @library ../lib
* @build JavadocTester
* @run main TestHref
*/
public class TestHref extends JavadocTester {
//Javadoc arguments.
private static final String[] ARGS = new String[] {
"-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "-linkoffline",
"http://java.sun.com/j2se/1.4/docs/api/", SRC_DIR, "pkg"
};
//Input for string search tests.
private static final String[][] TEST = {
//External link.
{ "pkg/C1.html",
"href=\"http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html?is-external=true#wait-long-int-\""
},
//Member summary table link.
{ "pkg/C1.html",
"href=\"../pkg/C1.html#method-int-int-java.util.ArrayList-\""
},
//Anchor test.
{ "pkg/C1.html",
"<a name=\"method-int-int-java.util.ArrayList-\">\n" +
"<!-- -->\n" +
"</a>"
},
//Backward compatibility anchor test.
{ "pkg/C1.html",
"<a name=\"method-int-int-java.util.ArrayList-\">\n" +
"<!-- -->\n" +
"</a>"
},
//{@link} test.
{ "pkg/C2.html",
"Link: <a href=\"../pkg/C1.html#method-int-int-java.util.ArrayList-\">"
},
//@see test.
{ "pkg/C2.html",
"See Also:</span></dt>\n" +
"<dd><a href=\"../pkg/C1.html#method-int-int-java.util.ArrayList-\">"
},
//Header does not link to the page itself.
{ "pkg/C4.html",
"Class C4&lt;E extends C4&lt;E&gt;&gt;</h2>"
},
//Signature does not link to the page itself.
{ "pkg/C4.html",
"public abstract class <span class=\"typeNameLabel\">C4&lt;E extends C4&lt;E&gt;&gt;</span>"
},
};
private static final String[][] NEGATED_TEST =
{
{WARNING_OUTPUT, "<a> tag is malformed"}
};
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
public static void main(String... args) throws Exception {
TestHref tester = new TestHref();
tester.run(ARGS, TEST, NEGATED_TEST);
tester.printSummary();
tester.runTests();
}
@Test
void test() {
javadoc("-Xdoclint:none",
"-d", "out",
"-sourcepath", testSrc,
"-linkoffline", "http://java.sun.com/j2se/1.4/docs/api/", testSrc,
"pkg");
checkExit(Exit.OK);
checkOutput("pkg/C1.html", true,
//External link.
"href=\"http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html?is-external=true#wait-long-int-\"",
//Member summary table link.
"href=\"../pkg/C1.html#method-int-int-java.util.ArrayList-\"",
//Anchor test.
"<a name=\"method-int-int-java.util.ArrayList-\">\n"
+ "<!-- -->\n"
+ "</a>",
//Backward compatibility anchor test."pkg/C1.html",
"<a name=\"method-int-int-java.util.ArrayList-\">\n"
+ "<!-- -->\n"
+ "</a>");
checkOutput("pkg/C2.html", true,
//{@link} test.
"Link: <a href=\"../pkg/C1.html#method-int-int-java.util.ArrayList-\">",
//@see test.
"See Also:</span></dt>\n"
+ "<dd><a href=\"../pkg/C1.html#method-int-int-java.util.ArrayList-\">"
);
checkOutput("pkg/C4.html", true,
//Header does not link to the page itself.
"Class C4&lt;E extends C4&lt;E&gt;&gt;</h2>",
//Signature does not link to the page itself.
"public abstract class <span class=\"typeNameLabel\">C4&lt;E extends C4&lt;E&gt;&gt;</span>"
);
checkOutput(Output.WARNING, false,
"<a> tag is malformed");
}
}

View file

@ -27,26 +27,22 @@
* @summary Determine if Hrefs are processed properly when they
* appear in doc comments.
* @author jamieh
* @library ../lib/
* @library ../lib
* @build JavadocTester
* @build TestHrefInDocComment
* @run main TestHrefInDocComment
*/
public class TestHrefInDocComment extends JavadocTester {
private static final String[] ARGS =
new String[] {
"-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg"};
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
public static void main(String... args) throws Exception {
TestHrefInDocComment tester = new TestHrefInDocComment();
if (tester.run(ARGS, NO_TEST, NO_TEST) != 0) {
throw new Error("Javadoc failed to execute properly with given source.");
}
tester.runTests();
}
@Test
void test() {
javadoc("-d", "out",
"-sourcepath", testSrc, "pkg");
checkExit(Exit.OK);
}
}

View file

@ -27,32 +27,26 @@
* @summary The field detail comment should not show up in the output if there
* are no fields to document.
* @author jamieh
* @library ../lib/
* @library ../lib
* @build JavadocTester
* @build TestHtmlComments
* @run main TestHtmlComments
*/
public class TestHtmlComments extends JavadocTester {
//Javadoc arguments.
private static final String[] ARGS = new String[] {
"-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, SRC_DIR + "/C.java"
};
//Input for string search tests.
private static final String[][] NEGATED_TEST = {
{ "C.html",
"<!-- ============ FIELD DETAIL =========== -->"}
};
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
public static void main(String... args) throws Exception {
TestHtmlComments tester = new TestHtmlComments();
tester.run(ARGS, NO_TEST, NEGATED_TEST);
tester.printSummary();
tester.runTests();
}
@Test
void run() {
javadoc("-d", "out",
"-sourcepath", testSrc,
testSrc("C.java"));
checkExit(Exit.OK);
checkOutput("C.html", false,
"<!-- ============ FIELD DETAIL =========== -->");
}
}

View file

@ -28,159 +28,250 @@
* @bug 6786690 6820360 8025633 8026567
* @summary This test verifies the nesting of definition list tags.
* @author Bhavesh Patel
* @library ../lib/
* @build JavadocTester TestHtmlDefinitionListTag
* @library ../lib
* @build JavadocTester
* @run main TestHtmlDefinitionListTag
*/
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class TestHtmlDefinitionListTag extends JavadocTester {
public static void main(String... args) throws Exception {
TestHtmlDefinitionListTag tester = new TestHtmlDefinitionListTag();
tester.runTests();
}
@Test
void test_Comment_Deprecated() {
// tester.run(ARGS1, TEST_ALL, NEGATED_TEST_NO_C5);
// tester.runTestsOnHTML(NO_TEST, NEGATED_TEST_C5);
// tester.runTestsOnHTML(TEST_CMNT_DEPR, NO_TEST);
javadoc("-Xdoclint:none",
"-d", "out-1",
"-sourcepath", testSrc,
"pkg1");
checkExit(Exit.OK);
checkCommon(true);
checkCommentDeprecated(true);
}
@Test
void test_NoComment_Deprecated() {
// tester.run(ARGS2, TEST_ALL, NEGATED_TEST_NO_C5);
// tester.runTestsOnHTML(NO_TEST, NEGATED_TEST_C5);
// tester.runTestsOnHTML(NO_TEST, TEST_CMNT_DEPR);
javadoc("-Xdoclint:none",
"-d", "out-2",
"-nocomment",
"-sourcepath", testSrc,
"pkg1");
checkExit(Exit.OK);
checkCommon(true);
checkCommentDeprecated(false); // ??
}
@Test
void test_Comment_NoDeprecated() {
// tester.run(ARGS3, TEST_ALL, NEGATED_TEST_NO_C5);
// tester.runTestsOnHTML(TEST_NODEPR, TEST_NOCMNT_NODEPR);
javadoc("-Xdoclint:none",
"-d", "out-3",
"-nodeprecated",
"-sourcepath", testSrc,
"pkg1");
checkExit(Exit.OK);
checkCommon(false);
checkNoDeprecated();
checkNoCommentNoDeprecated(false);
}
@Test
void testNoCommentNoDeprecated() {
// tester.run(ARGS4, TEST_ALL, NEGATED_TEST_NO_C5);
// tester.runTestsOnHTML(TEST_NOCMNT_NODEPR, TEST_CMNT_DEPR);
javadoc("-Xdoclint:none",
"-d", "out-4",
"-nocomment",
"-nodeprecated",
"-sourcepath", testSrc,
"pkg1");
checkExit(Exit.OK);
checkCommon(false);
checkNoCommentNoDeprecated(true);
checkCommentDeprecated(false);
}
void checkCommon(boolean checkC5) {
// Test common to all runs of javadoc. The class signature should print
// properly enclosed definition list tags and the Annotation Type
// Optional Element should print properly nested definition list tags
// for default value.
private static final String[][] TEST_ALL = {
{ "pkg1/C1.html",
checkOutput("pkg1/C1.html", true,
"<pre>public class <span class=\"typeNameLabel\">C1</span>\n" +
"extends java.lang.Object\n" +
"implements java.io.Serializable</pre>"},
{ "pkg1/C4.html",
"implements java.io.Serializable</pre>");
checkOutput("pkg1/C4.html", true,
"<dl>\n" +
"<dt>Default:</dt>\n" +
"<dd>true</dd>\n" +
"</dl>"}};
"</dl>");
// Test for valid HTML generation which should not comprise of empty
// definition list tags.
List<String> files= new ArrayList<>(Arrays.asList(
"pkg1/package-summary.html",
"pkg1/C1.html",
"pkg1/C1.ModalExclusionType.html",
"pkg1/C2.html",
"pkg1/C2.ModalType.html",
"pkg1/C3.html",
"pkg1/C4.html",
"overview-tree.html",
"serialized-form.html"
));
if (checkC5)
files.add("pkg1/C5.html");
for (String f: files) {
checkOutput(f, false,
"<dl></dl>",
"<dl>\n</dl>");
}
}
void checkCommentDeprecated(boolean expectFound) {
// Test for normal run of javadoc in which various ClassDocs and
// serialized form should have properly nested definition list tags
// enclosing comments, tags and deprecated information.
private static final String[][] TEST_CMNT_DEPR = {
{ "pkg1/package-summary.html",
checkOutput("pkg1/package-summary.html", expectFound,
"<dl>\n" +
"<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n" +
"<dd>JDK1.0</dd>\n" +
"</dl>"},
{ "pkg1/C1.html",
"<dl>\n" +
"<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n" +
"<dd>JDK1.0</dd>\n" +
"<dt><span class=\"seeLabel\">See Also:</span></dt>\n" +
"<dd><a href=\"../pkg1/C2.html\" title=\"class in pkg1\"><code>" +
"C2</code></a>, \n" +
"<a href=\"../serialized-form.html#pkg1.C1\">" +
"Serialized Form</a></dd>\n" +
"</dl>"},
{ "pkg1/C1.html",
"<dl>\n" +
"<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n" +
"<dd>1.4</dd>\n" +
"<dt><span class=\"seeLabel\">See Also:</span></dt>\n" +
"<dd><a href=\"../pkg1/C1.html#setUndecorated-boolean-\">" +
"<code>setUndecorated(boolean)</code></a></dd>\n" +
"</dl>"},
{ "pkg1/C1.html",
"<dl>\n" +
"<dt><span class=\"paramLabel\">Parameters:</span></dt>\n" +
"<dd><code>title</code> - the title</dd>\n" +
"<dd><code>test</code> - boolean value" +
"</dd>\n" +
"<dt><span class=\"throwsLabel\">Throws:</span></dt>\n" +
"<dd><code>java.lang.IllegalArgumentException</code> - if the " +
"<code>owner</code>'s\n" +
" <code>GraphicsConfiguration</code> is not from a screen " +
"device</dd>\n" +
"<dd><code>HeadlessException</code></dd>\n" +
"</dl>"},
{ "pkg1/C1.html",
"<dl>\n" +
"<dt><span class=\"paramLabel\">Parameters:</span></dt>\n" +
"<dd><code>undecorated" +
"</code> - <code>true</code> if no decorations are\n" +
" to be enabled;\n" +
" <code>false</code> " +
"if decorations are to be enabled.</dd>\n" +
"<dt><span class=\"simpleTagLabel\">Since:" +
"</span></dt>\n" +
"<dd>1.4</dd>\n" +
"<dt><span class=\"seeLabel\">See Also:</span></dt>\n" +
"<dd>" +
"<a href=\"../pkg1/C1.html#readObject--\"><code>readObject()" +
"</code></a></dd>\n" +
"</dl>"},
{ "pkg1/C1.html",
"<dl>\n" +
"<dt><span class=\"throwsLabel\">Throws:</span></dt>\n" +
"<dd><code>java.io.IOException</code></dd>\n" +
"<dt><span class=\"seeLabel\">See Also:" +
"</span></dt>\n" +
"<dd><a href=\"../pkg1/C1.html#setUndecorated-boolean-\">" +
"<code>setUndecorated(boolean)</code></a></dd>\n" +
"</dl>"},
{ "pkg1/C2.html",
"<dl>\n" +
"<dt><span class=\"paramLabel\">Parameters:" +
"</span></dt>\n" +
"<dd><code>set</code> - boolean</dd>\n" +
"<dt><span class=\"simpleTagLabel\">" +
"Since:</span></dt>\n" +
"<dd>1.4</dd>\n" +
"</dl>"},
{ "serialized-form.html",
"<dl>\n" +
"<dt><span class=\"throwsLabel\">Throws:</span>" +
"</dt>\n" +
"<dd><code>" +
"java.io.IOException</code></dd>\n" +
"<dt><span class=\"seeLabel\">See Also:</span>" +
"</dt>\n" +
"<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
"<code>C1.setUndecorated(boolean)</code></a></dd>\n" +
"</dl>"},
{ "serialized-form.html",
"<span class=\"deprecatedLabel\">Deprecated.</span>" +
"&nbsp;<span class=\"deprecationComment\">As of JDK version 1.5, replaced by\n" +
" <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
"<code>setUndecorated(boolean)</code></a>.</span></div>\n" +
"<div class=\"block\">This field indicates whether the C1 is " +
"undecorated.</div>\n" +
"&nbsp;\n" +
"<dl>\n" +
"<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n" +
"<dd>1.4</dd>\n" +
"<dt><span class=\"seeLabel\">See Also:</span>" +
"</dt>\n" +
"<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
"<code>C1.setUndecorated(boolean)</code></a></dd>\n" +
"</dl>"},
{ "serialized-form.html",
"<span class=\"deprecatedLabel\">Deprecated.</span>" +
"&nbsp;<span class=\"deprecationComment\">As of JDK version 1.5, replaced by\n" +
" <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
"<code>setUndecorated(boolean)</code></a>.</span></div>\n" +
"<div class=\"block\">Reads the object stream.</div>\n" +
"<dl>\n" +
"<dt><span class=\"throwsLabel\">Throws:" +
"</span></dt>\n" +
"<dd><code><code>" +
"IOException</code></code></dd>\n" +
"<dd><code>java.io.IOException</code></dd>\n" +
"</dl>"},
{ "serialized-form.html",
"<span class=\"deprecatedLabel\">Deprecated.</span>" +
"&nbsp;</div>\n" +
"<div class=\"block\">The name for this class.</div>"}};
"</dl>");
checkOutput("pkg1/C1.html", expectFound,
"<dl>\n"
+ "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n"
+ "<dd>JDK1.0</dd>\n"
+ "<dt><span class=\"seeLabel\">See Also:</span></dt>\n"
+ "<dd><a href=\"../pkg1/C2.html\" title=\"class in pkg1\"><code>"
+ "C2</code></a>, \n"
+ "<a href=\"../serialized-form.html#pkg1.C1\">"
+ "Serialized Form</a></dd>\n"
+ "</dl>",
"<dl>\n"
+ "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n"
+ "<dd>1.4</dd>\n"
+ "<dt><span class=\"seeLabel\">See Also:</span></dt>\n"
+ "<dd><a href=\"../pkg1/C1.html#setUndecorated-boolean-\">"
+ "<code>setUndecorated(boolean)</code></a></dd>\n"
+ "</dl>",
"<dl>\n"
+ "<dt><span class=\"paramLabel\">Parameters:</span></dt>\n"
+ "<dd><code>title</code> - the title</dd>\n"
+ "<dd><code>test</code> - boolean value"
+ "</dd>\n"
+ "<dt><span class=\"throwsLabel\">Throws:</span></dt>\n"
+ "<dd><code>java.lang.IllegalArgumentException</code> - if the "
+ "<code>owner</code>'s\n"
+ " <code>GraphicsConfiguration</code> is not from a screen "
+ "device</dd>\n"
+ "<dd><code>HeadlessException</code></dd>\n"
+ "</dl>",
"<dl>\n"
+ "<dt><span class=\"paramLabel\">Parameters:</span></dt>\n"
+ "<dd><code>undecorated"
+ "</code> - <code>true</code> if no decorations are\n"
+ " to be enabled;\n"
+ " <code>false</code> "
+ "if decorations are to be enabled.</dd>\n"
+ "<dt><span class=\"simpleTagLabel\">Since:"
+ "</span></dt>\n"
+ "<dd>1.4</dd>\n"
+ "<dt><span class=\"seeLabel\">See Also:</span></dt>\n"
+ "<dd>"
+ "<a href=\"../pkg1/C1.html#readObject--\"><code>readObject()"
+ "</code></a></dd>\n"
+ "</dl>",
"<dl>\n"
+ "<dt><span class=\"throwsLabel\">Throws:</span></dt>\n"
+ "<dd><code>java.io.IOException</code></dd>\n"
+ "<dt><span class=\"seeLabel\">See Also:"
+ "</span></dt>\n"
+ "<dd><a href=\"../pkg1/C1.html#setUndecorated-boolean-\">"
+ "<code>setUndecorated(boolean)</code></a></dd>\n"
+ "</dl>");
checkOutput("pkg1/C2.html", expectFound,
"<dl>\n"
+ "<dt><span class=\"paramLabel\">Parameters:"
+ "</span></dt>\n"
+ "<dd><code>set</code> - boolean</dd>\n"
+ "<dt><span class=\"simpleTagLabel\">"
+ "Since:</span></dt>\n"
+ "<dd>1.4</dd>\n"
+ "</dl>");
checkOutput("serialized-form.html", expectFound,
"<dl>\n"
+ "<dt><span class=\"throwsLabel\">Throws:</span>"
+ "</dt>\n"
+ "<dd><code>"
+ "java.io.IOException</code></dd>\n"
+ "<dt><span class=\"seeLabel\">See Also:</span>"
+ "</dt>\n"
+ "<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">"
+ "<code>C1.setUndecorated(boolean)</code></a></dd>\n"
+ "</dl>",
"<span class=\"deprecatedLabel\">Deprecated.</span>"
+ "&nbsp;<span class=\"deprecationComment\">As of JDK version 1.5, replaced by\n"
+ " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">"
+ "<code>setUndecorated(boolean)</code></a>.</span></div>\n"
+ "<div class=\"block\">This field indicates whether the C1 is "
+ "undecorated.</div>\n"
+ "&nbsp;\n"
+ "<dl>\n"
+ "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n"
+ "<dd>1.4</dd>\n"
+ "<dt><span class=\"seeLabel\">See Also:</span>"
+ "</dt>\n"
+ "<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">"
+ "<code>C1.setUndecorated(boolean)</code></a></dd>\n"
+ "</dl>",
"<span class=\"deprecatedLabel\">Deprecated.</span>"
+ "&nbsp;<span class=\"deprecationComment\">As of JDK version 1.5, replaced by\n"
+ " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">"
+ "<code>setUndecorated(boolean)</code></a>.</span></div>\n"
+ "<div class=\"block\">Reads the object stream.</div>\n"
+ "<dl>\n"
+ "<dt><span class=\"throwsLabel\">Throws:"
+ "</span></dt>\n"
+ "<dd><code><code>"
+ "IOException</code></code></dd>\n"
+ "<dd><code>java.io.IOException</code></dd>\n"
+ "</dl>",
"<span class=\"deprecatedLabel\">Deprecated.</span>"
+ "&nbsp;</div>\n"
+ "<div class=\"block\">The name for this class.</div>");
}
void checkNoDeprecated() {
// Test with -nodeprecated option. The ClassDocs should have properly nested
// definition list tags enclosing comments and tags. The ClassDocs should not
// display definition list for deprecated information. The serialized form
// should display properly nested definition list tags for comments, tags
// and deprecated information.
private static final String[][] TEST_NODEPR = {
{ "pkg1/package-summary.html",
checkOutput("pkg1/package-summary.html", true,
"<dl>\n" +
"<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n" +
"<dd>JDK1.0</dd>\n" +
"</dl>"},
{ "pkg1/C1.html",
"</dl>");
checkOutput("pkg1/C1.html", true,
"<dl>\n" +
"<dt><span class=\"simpleTagLabel\">Since:</span>" +
"</dt>\n" +
@ -191,216 +282,124 @@ public class TestHtmlDefinitionListTag extends JavadocTester {
"<code>C2</code></a>, \n" +
"<a href=\"../serialized-form.html#pkg1.C1\">" +
"Serialized Form</a></dd>\n" +
"</dl>"},
{ "pkg1/C1.html",
"<dl>\n" +
"<dt><span class=\"paramLabel\">Parameters:" +
"</span></dt>\n" +
"<dd><code>title</code> - the title</dd>\n" +
"<dd><code>" +
"test</code> - boolean value</dd>\n" +
"<dt><span class=\"throwsLabel\">Throws:" +
"</span></dt>\n" +
"<dd><code>java.lang.IllegalArgumentException" +
"</code> - if the <code>owner</code>'s\n" +
" <code>GraphicsConfiguration" +
"</code> is not from a screen device</dd>\n" +
"<dd><code>" +
"HeadlessException</code></dd>\n" +
"</dl>"},
{ "pkg1/C1.html",
"<dl>\n" +
"<dt><span class=\"paramLabel\">Parameters:" +
"</span></dt>\n" +
"<dd><code>undecorated</code> - <code>true</code>" +
" if no decorations are\n" +
" to be enabled;\n" +
" <code>false</code> if decorations are to be enabled." +
"</dd>\n" +
"<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n" +
"<dd>1.4</dd>\n" +
"<dt><span class=\"seeLabel\">See Also:</span></dt>\n" +
"<dd><a href=\"../pkg1/C1.html#readObject--\">" +
"<code>readObject()</code></a></dd>\n" +
"</dl>"},
{ "pkg1/C1.html",
"<dl>\n" +
"<dt><span class=\"throwsLabel\">Throws:</span>" +
"</dt>\n" +
"<dd><code>java.io.IOException</code></dd>\n" +
"<dt>" +
"<span class=\"seeLabel\">See Also:</span></dt>\n" +
"<dd><a href=\"../pkg1/C1.html#setUndecorated-boolean-\">" +
"<code>setUndecorated(boolean)</code></a></dd>\n" +
"</dl>"},
{ "serialized-form.html",
"<dl>\n" +
"<dt><span class=\"throwsLabel\">Throws:</span>" +
"</dt>\n" +
"<dd><code>" +
"java.io.IOException</code></dd>\n" +
"<dt><span class=\"seeLabel\">See Also:</span>" +
"</dt>\n" +
"<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
"<code>C1.setUndecorated(boolean)</code></a></dd>\n" +
"</dl>"},
{ "serialized-form.html",
"<span class=\"deprecatedLabel\">Deprecated.</span>" +
"&nbsp;<span class=\"deprecationComment\">As of JDK version 1.5, replaced by\n" +
" <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
"<code>setUndecorated(boolean)</code></a>.</span></div>\n" +
"<div class=\"block\">This field indicates whether the C1 is " +
"undecorated.</div>\n" +
"&nbsp;\n" +
"<dl>\n" +
"<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n" +
"<dd>1.4</dd>\n" +
"<dt><span class=\"seeLabel\">See Also:</span>" +
"</dt>\n" +
"<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
"<code>C1.setUndecorated(boolean)</code></a></dd>\n" +
"</dl>"},
{ "serialized-form.html",
"<span class=\"deprecatedLabel\">Deprecated.</span>" +
"&nbsp;<span class=\"deprecationComment\">As of JDK version 1.5, replaced by\n" +
" <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
"<code>setUndecorated(boolean)</code></a>.</span></div>\n" +
"<div class=\"block\">Reads the object stream.</div>\n" +
"<dl>\n" +
"<dt><span class=\"throwsLabel\">Throws:" +
"</span></dt>\n" +
"<dd><code><code>" +
"IOException</code></code></dd>\n" +
"<dd><code>java.io.IOException</code></dd>\n" +
"</dl>"},
{ "serialized-form.html",
"<span class=\"deprecatedLabel\">Deprecated.</span>" +
"&nbsp;</div>\n" +
"<div class=\"block\">" +
"The name for this class.</div>"}};
"</dl>");
checkOutput("pkg1/C1.html", true,
"<dl>\n"
+ "<dt><span class=\"paramLabel\">Parameters:"
+ "</span></dt>\n"
+ "<dd><code>title</code> - the title</dd>\n"
+ "<dd><code>"
+ "test</code> - boolean value</dd>\n"
+ "<dt><span class=\"throwsLabel\">Throws:"
+ "</span></dt>\n"
+ "<dd><code>java.lang.IllegalArgumentException"
+ "</code> - if the <code>owner</code>'s\n"
+ " <code>GraphicsConfiguration"
+ "</code> is not from a screen device</dd>\n"
+ "<dd><code>"
+ "HeadlessException</code></dd>\n"
+ "</dl>",
"<dl>\n"
+ "<dt><span class=\"paramLabel\">Parameters:"
+ "</span></dt>\n"
+ "<dd><code>undecorated</code> - <code>true</code>"
+ " if no decorations are\n"
+ " to be enabled;\n"
+ " <code>false</code> if decorations are to be enabled."
+ "</dd>\n"
+ "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n"
+ "<dd>1.4</dd>\n"
+ "<dt><span class=\"seeLabel\">See Also:</span></dt>\n"
+ "<dd><a href=\"../pkg1/C1.html#readObject--\">"
+ "<code>readObject()</code></a></dd>\n"
+ "</dl>",
"<dl>\n"
+ "<dt><span class=\"throwsLabel\">Throws:</span>"
+ "</dt>\n"
+ "<dd><code>java.io.IOException</code></dd>\n"
+ "<dt>"
+ "<span class=\"seeLabel\">See Also:</span></dt>\n"
+ "<dd><a href=\"../pkg1/C1.html#setUndecorated-boolean-\">"
+ "<code>setUndecorated(boolean)</code></a></dd>\n"
+ "</dl>");
checkOutput("serialized-form.html", true,
"<dl>\n"
+ "<dt><span class=\"throwsLabel\">Throws:</span>"
+ "</dt>\n"
+ "<dd><code>"
+ "java.io.IOException</code></dd>\n"
+ "<dt><span class=\"seeLabel\">See Also:</span>"
+ "</dt>\n"
+ "<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">"
+ "<code>C1.setUndecorated(boolean)</code></a></dd>\n"
+ "</dl>",
"<span class=\"deprecatedLabel\">Deprecated.</span>"
+ "&nbsp;<span class=\"deprecationComment\">As of JDK version 1.5, replaced by\n"
+ " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">"
+ "<code>setUndecorated(boolean)</code></a>.</span></div>\n"
+ "<div class=\"block\">This field indicates whether the C1 is "
+ "undecorated.</div>\n"
+ "&nbsp;\n"
+ "<dl>\n"
+ "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n"
+ "<dd>1.4</dd>\n"
+ "<dt><span class=\"seeLabel\">See Also:</span>"
+ "</dt>\n"
+ "<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">"
+ "<code>C1.setUndecorated(boolean)</code></a></dd>\n"
+ "</dl>",
"<span class=\"deprecatedLabel\">Deprecated.</span>"
+ "&nbsp;<span class=\"deprecationComment\">As of JDK version 1.5, replaced by\n"
+ " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">"
+ "<code>setUndecorated(boolean)</code></a>.</span></div>\n"
+ "<div class=\"block\">Reads the object stream.</div>\n"
+ "<dl>\n"
+ "<dt><span class=\"throwsLabel\">Throws:"
+ "</span></dt>\n"
+ "<dd><code><code>"
+ "IOException</code></code></dd>\n"
+ "<dd><code>java.io.IOException</code></dd>\n"
+ "</dl>",
"<span class=\"deprecatedLabel\">Deprecated.</span>"
+ "&nbsp;</div>\n"
+ "<div class=\"block\">"
+ "The name for this class.</div>");
}
void checkNoCommentNoDeprecated(boolean expectFound) {
// Test with -nocomment and -nodeprecated options. The ClassDocs whould
// not display definition lists for any member details.
private static final String[][] TEST_NOCMNT_NODEPR = {
{ "pkg1/C1.html",
checkOutput("pkg1/C1.html", expectFound,
"<pre>public&nbsp;void&nbsp;readObject()\n" +
" throws java.io.IOException</pre>\n" +
"</li>"},
{ "pkg1/C2.html", "<pre>public&nbsp;C2()</pre>\n" +
"</li>"},
{ "pkg1/C1.ModalExclusionType.html", "<pre>public " +
"</li>");
checkOutput("pkg1/C2.html", expectFound,
"<pre>public&nbsp;C2()</pre>\n" +
"</li>");
checkOutput("pkg1/C1.ModalExclusionType.html", expectFound,
"<pre>public " +
"static final&nbsp;<a href=\"../pkg1/C1.ModalExclusionType.html\" " +
"title=\"enum in pkg1\">C1.ModalExclusionType</a> " +
"APPLICATION_EXCLUDE</pre>\n" +
"</li>"},
{ "serialized-form.html", "<pre>boolean " +
"</li>");
checkOutput("serialized-form.html", expectFound,
"<pre>boolean " +
"undecorated</pre>\n" +
"<div class=\"block\"><span class=\"deprecatedLabel\">" +
"Deprecated.</span>&nbsp;<span class=\"deprecationComment\">As of JDK version 1.5, replaced by\n" +
" <a href=\"pkg1/C1.html#setUndecorated-boolean-\"><code>" +
"setUndecorated(boolean)</code></a>.</span></div>\n" +
"</li>"},
{ "serialized-form.html", "<span class=\"deprecatedLabel\">" +
"</li>",
"<span class=\"deprecatedLabel\">" +
"Deprecated.</span>&nbsp;<span class=\"deprecationComment\">As of JDK version" +
" 1.5, replaced by\n" +
" <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
"<code>setUndecorated(boolean)</code></a>.</span></div>\n" +
"</li>"}};
// Test for valid HTML generation which should not comprise of empty
// definition list tags.
private static final String[][] NEGATED_TEST_NO_C5 = {
{ "pkg1/package-summary.html",
"<dl></dl>"},
{ "pkg1/package-summary.html",
"<dl>\n" +
"</dl>"},
{ "pkg1/C1.html",
"<dl></dl>"},
{ "pkg1/C1.html",
"<dl>\n" +
"</dl>"},
{ "pkg1/C1.ModalExclusionType.html",
"<dl></dl>"},
{ "pkg1/C1.ModalExclusionType.html",
"<dl>\n" +
"</dl>"},
{ "pkg1/C2.html",
"<dl></dl>"},
{ "pkg1/C2.html",
"<dl>\n" +
"</dl>"},
{ "pkg1/C2.ModalType.html",
"<dl></dl>"},
{ "pkg1/C2.ModalType.html",
"<dl>\n" +
"</dl>"},
{ "pkg1/C3.html",
"<dl></dl>"},
{ "pkg1/C3.html",
"<dl>\n" +
"</dl>"},
{ "pkg1/C4.html",
"<dl></dl>"},
{ "pkg1/C4.html",
"<dl>\n" +
"</dl>"},
{ "overview-tree.html",
"<dl></dl>"},
{ "overview-tree.html",
"<dl>\n" +
"</dl>"},
{ "serialized-form.html",
"<dl></dl>"},
{ "serialized-form.html",
"<dl>\n" +
"</dl>"}};
private static final String[][] NEGATED_TEST_C5 = {
{ "pkg1/C5.html",
"<dl></dl>"},
{ "pkg1/C5.html",
"<dl>\n" +
"</dl>"}};
private static final String[] ARGS1 =
new String[] {
"-Xdoclint:none", "-d", OUTPUT_DIR + "-1", "-sourcepath", SRC_DIR, "pkg1"};
private static final String[] ARGS2 =
new String[] {
"-Xdoclint:none", "-d", OUTPUT_DIR + "-2", "-nocomment", "-sourcepath",
SRC_DIR, "pkg1"};
private static final String[] ARGS3 =
new String[] {
"-Xdoclint:none", "-d", OUTPUT_DIR + "-3", "-nodeprecated", "-sourcepath",
SRC_DIR, "pkg1"};
private static final String[] ARGS4 =
new String[] {
"-Xdoclint:none", "-d", OUTPUT_DIR + "-4", "-nocomment", "-nodeprecated",
"-sourcepath", SRC_DIR, "pkg1"};
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
TestHtmlDefinitionListTag tester = new TestHtmlDefinitionListTag();
tester.run(ARGS1, TEST_ALL, NEGATED_TEST_NO_C5);
tester.runTestsOnHTML(NO_TEST, NEGATED_TEST_C5);
tester.runTestsOnHTML(TEST_CMNT_DEPR, NO_TEST);
tester.run(ARGS2, TEST_ALL, NEGATED_TEST_NO_C5);
tester.runTestsOnHTML(NO_TEST, NEGATED_TEST_C5);
tester.runTestsOnHTML(NO_TEST, TEST_CMNT_DEPR);
tester.run(ARGS3, TEST_ALL, NEGATED_TEST_NO_C5);
tester.runTestsOnHTML(TEST_NODEPR, TEST_NOCMNT_NODEPR);
tester.run(ARGS4, TEST_ALL, NEGATED_TEST_NO_C5);
tester.runTestsOnHTML(TEST_NOCMNT_NODEPR, TEST_CMNT_DEPR);
tester.printSummary();
"</li>");
}
}

View file

@ -27,33 +27,38 @@
* @test
* @bug 6851834
* @summary This test verifies the HTML document generation for javadoc output.
* @library ../lib
* @build JavadocTester
* @author Bhavesh Patel
* @build TestHtmlDocument
* @run main TestHtmlDocument
*/
import java.io.*;
import com.sun.tools.doclets.formats.html.markup.*;
/**
* The class reads each file, complete with newlines, into a string to easily
* compare the existing markup with the generated markup.
*/
public class TestHtmlDocument {
protected static final String NL = System.getProperty("line.separator");
private static final String BUGID = "6851834";
private static final String BUGNAME = "TestHtmlDocument";
private static String srcdir = System.getProperty("test.src", ".");
public class TestHtmlDocument extends JavadocTester {
// Entry point
public static void main(String[] args) throws IOException {
public static void main(String... args) throws Exception {
TestHtmlDocument tester = new TestHtmlDocument();
tester.runTests();
}
@Test
void test() {
checking("markup");
// Check whether the generated markup is same as the existing markup.
if (generateHtmlTree().equals(readFileToString(srcdir + "/testMarkup.html"))) {
System.out.println("\nTest passed for bug " + BUGID + " (" + BUGNAME + ")\n");
String expected = readFile(testSrc, "testMarkup.html");
String actual = generateHtmlTree();
if (actual.equals(expected)) {
passed("");
} else {
throw new Error("\nTest failed for bug " + BUGID + " (" + BUGNAME + ")\n");
failed("expected content in " + testSrc("testMarkup.html") + "\n"
+ "Actual output:\n"
+ actual);
}
}
@ -136,25 +141,4 @@ public class TestHtmlDocument {
HtmlDocument htmlDoc = new HtmlDocument(htmlDocType, html);
return htmlDoc.toString();
}
// Read the file into a String
public static String readFileToString(String filename) throws IOException {
File file = new File(filename);
if ( !file.exists() ) {
System.out.println("\nFILE DOES NOT EXIST: " + filename);
}
BufferedReader in = new BufferedReader(new FileReader(file));
StringBuilder fileString = new StringBuilder();
// Create an array of characters the size of the file
try {
String line;
while ((line = in.readLine()) != null) {
fileString.append(line);
fileString.append(NL);
}
} finally {
in.close();
}
return fileString.toString();
}
}

View file

@ -26,44 +26,49 @@
/*
* @test
* @bug 6786028 8026567
* @summary This test verifys the use of <strong> HTML tag instead of <B> by Javadoc std doclet.
* @summary This test verifies the use of <strong> HTML tag instead of <B> by Javadoc std doclet.
* @author Bhavesh Patel
* @library ../lib/
* @library ../lib
* @build JavadocTester
* @build TestHtmlStrongTag
* @run main TestHtmlStrongTag
*/
public class TestHtmlStrongTag extends JavadocTester {
private static final String[][] TEST1 = {
{ "pkg1/C1.html",
"<span class=\"seeLabel\">See Also:</span>"}};
private static final String[][] NEGATED_TEST1 = {
{ "pkg1/C1.html", "<STRONG>Method Summary</STRONG>"},
{ "pkg1/C1.html", "<B>"},
{ "pkg1/package-summary.html",
"<STRONG>Class Summary</STRONG>"}};
private static final String[][] TEST2 = {
{ "pkg2/C2.html", "<B>Comments:</B>"}};
private static final String[][] NEGATED_TEST2 = {
{ "pkg2/C2.html", "<STRONG>Method Summary</STRONG>"}};
private static final String[] ARGS1 =
new String[] {
"-d", OUTPUT_DIR + "-1", "-sourcepath", SRC_DIR, "pkg1"};
private static final String[] ARGS2 =
new String[] {
"-d", OUTPUT_DIR + "-2", "-sourcepath", SRC_DIR, "pkg2"};
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
public static void main(String... args) throws Exception {
TestHtmlStrongTag tester = new TestHtmlStrongTag();
tester.run(ARGS1, TEST1, NEGATED_TEST1);
tester.run(ARGS2, TEST2, NEGATED_TEST2);
tester.printSummary();
tester.runTests();
}
@Test
void test1() {
javadoc("-d", "out-1",
"-sourcepath", testSrc,
"pkg1");
checkExit(Exit.OK);
checkOutput("pkg1/C1.html", true,
"<span class=\"seeLabel\">See Also:</span>");
checkOutput("pkg1/C1.html", false,
"<STRONG>Method Summary</STRONG>",
"<B>");
checkOutput("pkg1/package-summary.html", false,
"<STRONG>Class Summary</STRONG>");
}
@Test
void test2() {
javadoc("-d", "out-2",
"-sourcepath", testSrc,
"pkg2");
checkExit(Exit.OK);
checkOutput("pkg2/C2.html", true,
"<B>Comments:</B>");
checkOutput("pkg2/C2.html", false,
"<STRONG>Method Summary</STRONG>");
}
}

View file

@ -26,69 +26,59 @@
* @bug 8008164
* @summary Test styles on HTML tables generated by javadoc.
* @author Bhavesh Patel
* @library ../lib/
* @build JavadocTester TestHtmlTableStyles
* @library ../lib
* @build JavadocTester
* @run main TestHtmlTableStyles
*/
public class TestHtmlTableStyles extends JavadocTester {
//Input for string search tests.
private static final String[][] TEST = {
{ "pkg1/TestTable.html",
"<table border cellpadding=3 cellspacing=1>"
},
{ "pkg1/TestTable.html",
"<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" " +
"cellspacing=\"0\" summary=\"Field Summary table, listing fields, " +
"and an explanation\">"
},
{ "pkg1/TestTable.html",
"<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" " +
"cellspacing=\"0\" summary=\"Constructor Summary table, listing " +
"constructors, and an explanation\">"
},
{ "pkg1/TestTable.html",
"<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" " +
"cellspacing=\"0\" summary=\"Method Summary table, listing methods, " +
"and an explanation\">"
},
{ "pkg1/package-summary.html",
"<table class=\"typeSummary\" border=\"0\" cellpadding=\"3\" " +
"cellspacing=\"0\" summary=\"Class Summary table, listing classes, " +
"and an explanation\">"
},
{ "pkg1/class-use/TestTable.html",
"<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" " +
"cellspacing=\"0\" summary=\"Use table, listing fields, and an explanation\">"
},
{ "overview-summary.html",
"<table class=\"overviewSummary\" border=\"0\" cellpadding=\"3\" " +
"cellspacing=\"0\" summary=\"Packages table, listing packages, and an explanation\">"
},
{ "deprecated-list.html",
public static void main(String... args) throws Exception {
TestHtmlTableStyles tester = new TestHtmlTableStyles();
tester.runTests();
}
@Test
void test() {
javadoc("-d", "out",
"-sourcepath", testSrc,
"-use",
"pkg1", "pkg2");
checkExit(Exit.OK);
checkOutput("pkg1/TestTable.html", true,
"<table border cellpadding=3 cellspacing=1>",
"<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" "
+ "cellspacing=\"0\" summary=\"Field Summary table, listing fields, "
+ "and an explanation\">",
"<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" "
+ "cellspacing=\"0\" summary=\"Constructor Summary table, listing "
+ "constructors, and an explanation\">",
"<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" "
+ "cellspacing=\"0\" summary=\"Method Summary table, listing methods, "
+ "and an explanation\">");
checkOutput("pkg1/package-summary.html", true,
"<table class=\"typeSummary\" border=\"0\" cellpadding=\"3\" "
+ "cellspacing=\"0\" summary=\"Class Summary table, listing classes, "
+ "and an explanation\">");
checkOutput("pkg1/class-use/TestTable.html", true,
"<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" "
+ "cellspacing=\"0\" summary=\"Use table, listing fields, and an explanation\">");
checkOutput("overview-summary.html", true,
"<table class=\"overviewSummary\" border=\"0\" cellpadding=\"3\" "
+ "cellspacing=\"0\" summary=\"Packages table, listing packages, and an explanation\">");
checkOutput("deprecated-list.html", true,
"<table class=\"deprecatedSummary\" border=\"0\" cellpadding=\"3\" " +
"cellspacing=\"0\" summary=\"Deprecated Methods table, listing " +
"deprecated methods, and an explanation\">"
},
{ "constant-values.html",
"deprecated methods, and an explanation\">");
checkOutput("constant-values.html", true,
"<table class=\"constantsSummary\" border=\"0\" cellpadding=\"3\" " +
"cellspacing=\"0\" summary=\"Constant Field Values table, listing " +
"constant fields, and values\">"
},
};
private static final String[] ARGS = new String[] {
"-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "-use", "pkg1", "pkg2"
};
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) throws Exception {
TestHtmlTableStyles tester = new TestHtmlTableStyles();
tester.run(ARGS, TEST, NO_TEST);
tester.printSummary();
"constant fields, and values\">");
}
}

View file

@ -26,9 +26,8 @@
* @bug 6786688 8008164
* @summary HTML tables should have table summary, caption and table headers.
* @author Bhavesh Patel
* @library ../lib/
* @library ../lib
* @build JavadocTester
* @build TestHtmlTableTags
* @run main TestHtmlTableTags
*/
@ -36,400 +35,350 @@ public class TestHtmlTableTags extends JavadocTester {
//Javadoc arguments.
private static final String[] ARGS = new String[] {
"-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "-use", "pkg1", "pkg2"
};
//Input for string tests for HTML table tags.
private static final String[][] TABLE_TAGS_TEST = {
/*
* Test for validating summary for HTML tables
*/
//Package summary
{ "pkg1/package-summary.html",
"<table class=\"typeSummary\" border=\"0\" cellpadding=\"3\"" +
" cellspacing=\"0\" summary=\"Class Summary table, " +
"listing classes, and an explanation\">"
},
{ "pkg1/package-summary.html",
"<table class=\"typeSummary\" border=\"0\" cellpadding=\"3\"" +
" cellspacing=\"0\" summary=\"Interface Summary table, " +
"listing interfaces, and an explanation\">"
},
{ "pkg2/package-summary.html",
"<table class=\"typeSummary\" border=\"0\" cellpadding=\"3\"" +
" cellspacing=\"0\" summary=\"Enum Summary table, " +
"listing enums, and an explanation\">"
},
{ "pkg2/package-summary.html",
"<table class=\"typeSummary\" border=\"0\" cellpadding=\"3\"" +
" cellspacing=\"0\" summary=\"Annotation Types Summary table, " +
"listing annotation types, and an explanation\">"
},
// Class documentation
{ "pkg1/C1.html",
"<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" " +
"cellspacing=\"0\" summary=\"Field Summary table, listing fields, " +
"and an explanation\">"
},
{ "pkg1/C1.html",
"<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" " +
"cellspacing=\"0\" summary=\"Method Summary table, listing methods, " +
"and an explanation\">"
},
{ "pkg2/C2.html",
"<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" " +
"cellspacing=\"0\" summary=\"Nested Class Summary table, listing " +
"nested classes, and an explanation\">"
},
{ "pkg2/C2.html",
"<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" " +
"cellspacing=\"0\" summary=\"Constructor Summary table, listing " +
"constructors, and an explanation\">"
},
{ "pkg2/C2.ModalExclusionType.html",
"<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" " +
"cellspacing=\"0\" summary=\"Enum Constant Summary table, listing " +
"enum constants, and an explanation\">"
},
{ "pkg2/C3.html",
"<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" " +
"cellspacing=\"0\" summary=\"Required Element Summary table, " +
"listing required elements, and an explanation\">"
},
{ "pkg2/C4.html",
"<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" " +
"cellspacing=\"0\" summary=\"Optional Element Summary table, " +
"listing optional elements, and an explanation\">"
},
// Class use documentation
{ "pkg1/class-use/I1.html",
"<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " +
"table, listing packages, and an explanation\">"
},
{ "pkg1/class-use/C1.html",
"<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " +
"table, listing fields, and an explanation\">"
},
{ "pkg1/class-use/C1.html",
"<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " +
"table, listing methods, and an explanation\">"
},
{ "pkg2/class-use/C2.html",
"<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " +
"table, listing fields, and an explanation\">"
},
{ "pkg2/class-use/C2.html",
"<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " +
"table, listing methods, and an explanation\">"
},
{ "pkg2/class-use/C2.ModalExclusionType.html",
"<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " +
"table, listing packages, and an explanation\">"
},
{ "pkg2/class-use/C2.ModalExclusionType.html",
"<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " +
"table, listing methods, and an explanation\">"
},
// Package use documentation
{ "pkg1/package-use.html",
"<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " +
"table, listing packages, and an explanation\">"
},
{ "pkg1/package-use.html",
"<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " +
"table, listing classes, and an explanation\">"
},
{ "pkg2/package-use.html",
"<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " +
"table, listing packages, and an explanation\">"
},
{ "pkg2/package-use.html",
"<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " +
"table, listing classes, and an explanation\">"
},
// Deprecated
{ "deprecated-list.html",
"<table class=\"deprecatedSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" " +
"summary=\"Deprecated Fields table, listing deprecated fields, " +
"and an explanation\">"
},
{ "deprecated-list.html",
"<table class=\"deprecatedSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" " +
"summary=\"Deprecated Methods table, listing deprecated methods, " +
"and an explanation\">"
},
// Constant values
{ "constant-values.html",
"<table class=\"constantsSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" " +
"summary=\"Constant Field Values table, listing " +
"constant fields, and values\">"
},
// Overview Summary
{ "overview-summary.html",
"<table class=\"overviewSummary\" border=\"0\" cellpadding=\"3\" " +
"cellspacing=\"0\" summary=\"Packages table, " +
"listing packages, and an explanation\">"
},
public static void main(String... args) throws Exception {
TestHtmlTableTags tester = new TestHtmlTableTags();
tester.runTests();
}
@Test
void test() {
javadoc("-d", "out",
"-sourcepath", testSrc,
"-use",
"pkg1", "pkg2");
checkExit(Exit.OK);
checkHtmlTableSummaries();
checkHtmlTableCaptions();
checkHtmlTableHeaders();
}
/*
* Test for validating caption for HTML tables
* Tests for validating summary for HTML tables
*/
void checkHtmlTableSummaries() {
//Package summary
{ "pkg1/package-summary.html",
"<caption><span>Class Summary</span><span class=\"tabEnd\">" +
"&nbsp;</span></caption>"
},
{ "pkg1/package-summary.html",
"<caption><span>Interface Summary</span><span class=\"tabEnd\">" +
"&nbsp;</span></caption>"
},
{ "pkg2/package-summary.html",
"<caption><span>Enum Summary</span><span class=\"tabEnd\">" +
"&nbsp;</span></caption>"
},
{ "pkg2/package-summary.html",
"<caption><span>Annotation Types Summary</span><span class=\"tabEnd\">" +
"&nbsp;</span></caption>"
},
checkOutput("pkg1/package-summary.html", true,
"<table class=\"typeSummary\" border=\"0\" cellpadding=\"3\""
+ " cellspacing=\"0\" summary=\"Class Summary table, "
+ "listing classes, and an explanation\">",
"<table class=\"typeSummary\" border=\"0\" cellpadding=\"3\""
+ " cellspacing=\"0\" summary=\"Interface Summary table, "
+ "listing interfaces, and an explanation\">");
checkOutput("pkg2/package-summary.html", true,
"<table class=\"typeSummary\" border=\"0\" cellpadding=\"3\""
+ " cellspacing=\"0\" summary=\"Enum Summary table, "
+ "listing enums, and an explanation\">",
"<table class=\"typeSummary\" border=\"0\" cellpadding=\"3\""
+ " cellspacing=\"0\" summary=\"Annotation Types Summary table, "
+ "listing annotation types, and an explanation\">");
// Class documentation
{ "pkg1/C1.html",
"<caption><span>Fields</span><span class=\"tabEnd\">&nbsp;</span></caption>"
},
{ "pkg1/C1.html",
"<caption><span id=\"t0\" class=\"activeTableTab\"><span>All " +
"Methods</span><span class=\"tabEnd\">&nbsp;</span></span>" +
"<span id=\"t2\" class=\"tableTab\"><span><a href=\"javascript:show(2);\">" +
"Instance Methods</a></span><span class=\"tabEnd\">&nbsp;</span></span>" +
"<span id=\"t4\" class=\"tableTab\"><span><a href=\"javascript:show(8);\">" +
"Concrete Methods</a></span><span class=\"tabEnd\">&nbsp;</span></span>" +
"<span id=\"t6\" class=\"tableTab\"><span><a href=\"javascript:show(32);\">" +
"Deprecated Methods</a></span><span class=\"tabEnd\">&nbsp;</span></span>" +
"</caption>"
},
{ "pkg2/C2.html",
"<caption><span>Nested Classes</span><span class=\"tabEnd\">&nbsp;</span></caption>"
},
{ "pkg2/C2.html",
"<caption><span>Constructors</span><span class=\"tabEnd\">&nbsp;</span></caption>"
},
{ "pkg2/C2.ModalExclusionType.html",
"<caption><span>Enum Constants</span><span class=\"tabEnd\">&nbsp;</span></caption>"
},
{ "pkg2/C3.html",
"<caption><span>Required Elements</span><span class=\"tabEnd\">&nbsp;" +
"</span></caption>"
},
{ "pkg2/C4.html",
"<caption><span>Optional Elements</span><span class=\"tabEnd\">&nbsp;" +
"</span></caption>"
},
checkOutput("pkg1/C1.html", true,
"<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" "
+ "cellspacing=\"0\" summary=\"Field Summary table, listing fields, "
+ "and an explanation\">",
"<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" "
+ "cellspacing=\"0\" summary=\"Method Summary table, listing methods, "
+ "and an explanation\">");
checkOutput("pkg2/C2.html", true,
"<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" "
+ "cellspacing=\"0\" summary=\"Nested Class Summary table, listing "
+ "nested classes, and an explanation\">",
"<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" "
+ "cellspacing=\"0\" summary=\"Constructor Summary table, listing "
+ "constructors, and an explanation\">");
checkOutput("pkg2/C2.ModalExclusionType.html", true,
"<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" "
+ "cellspacing=\"0\" summary=\"Enum Constant Summary table, listing "
+ "enum constants, and an explanation\">");
checkOutput("pkg2/C3.html", true,
"<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" "
+ "cellspacing=\"0\" summary=\"Required Element Summary table, "
+ "listing required elements, and an explanation\">");
checkOutput("pkg2/C4.html", true,
"<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" "
+ "cellspacing=\"0\" summary=\"Optional Element Summary table, "
+ "listing optional elements, and an explanation\">");
// Class use documentation
{ "pkg1/class-use/I1.html",
"<caption><span>Packages that use <a href=\"../../pkg1/I1.html\" " +
"title=\"interface in pkg1\">I1</a></span><span class=\"tabEnd\">" +
"&nbsp;</span></caption>"
},
{ "pkg1/class-use/C1.html",
"<caption><span>Fields in <a href=\"../../pkg2/package-summary.html\">" +
"pkg2</a> declared as <a href=\"../../pkg1/C1.html\" " +
"title=\"class in pkg1\">C1</a></span><span class=\"tabEnd\">&nbsp;" +
"</span></caption>"
},
{ "pkg1/class-use/C1.html",
"<caption><span>Methods in <a href=\"../../pkg2/package-summary.html\">" +
"pkg2</a> that return <a href=\"../../pkg1/C1.html\" " +
"title=\"class in pkg1\">C1</a></span><span class=\"tabEnd\">" +
"&nbsp;</span></caption>"
},
{ "pkg2/class-use/C2.html",
"<caption><span>Fields in <a href=\"../../pkg1/package-summary.html\">" +
"pkg1</a> declared as <a href=\"../../pkg2/C2.html\" " +
"title=\"class in pkg2\">C2</a></span><span class=\"tabEnd\">" +
"&nbsp;</span></caption>"
},
{ "pkg2/class-use/C2.html",
"<caption><span>Methods in <a href=\"../../pkg1/package-summary.html\">" +
"pkg1</a> that return <a href=\"../../pkg2/C2.html\" " +
"title=\"class in pkg2\">C2</a></span><span class=\"tabEnd\">" +
"&nbsp;</span></caption>"
},
{ "pkg2/class-use/C2.ModalExclusionType.html",
"<caption><span>Methods in <a href=\"../../pkg2/package-summary.html\">" +
"pkg2</a> that return <a href=\"../../pkg2/C2.ModalExclusionType.html\" " +
"title=\"enum in pkg2\">C2.ModalExclusionType</a></span>" +
"<span class=\"tabEnd\">&nbsp;</span></caption>"
},
checkOutput("pkg1/class-use/I1.html", true,
"<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use "
+ "table, listing packages, and an explanation\">");
checkOutput("pkg1/class-use/C1.html", true,
"<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use "
+ "table, listing fields, and an explanation\">",
"<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use "
+ "table, listing methods, and an explanation\">");
checkOutput("pkg2/class-use/C2.html", true,
"<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use "
+ "table, listing fields, and an explanation\">",
"<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use "
+ "table, listing methods, and an explanation\">");
checkOutput("pkg2/class-use/C2.ModalExclusionType.html", true,
"<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use "
+ "table, listing packages, and an explanation\">");
checkOutput("pkg2/class-use/C2.ModalExclusionType.html", true,
"<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use "
+ "table, listing methods, and an explanation\">");
// Package use documentation
{ "pkg1/package-use.html",
"<caption><span>Packages that use <a href=\"../pkg1/package-summary.html\">" +
"pkg1</a></span><span class=\"tabEnd\">&nbsp;</span></caption>"
},
{ "pkg1/package-use.html",
"<caption><span>Classes in <a href=\"../pkg1/package-summary.html\">" +
"pkg1</a> used by <a href=\"../pkg1/package-summary.html\">pkg1</a>" +
"</span><span class=\"tabEnd\">&nbsp;</span></caption>"
},
{ "pkg2/package-use.html",
"<caption><span>Packages that use <a href=\"../pkg2/package-summary.html\">" +
"pkg2</a></span><span class=\"tabEnd\">&nbsp;</span></caption>"
},
{ "pkg2/package-use.html",
"<caption><span>Classes in <a href=\"../pkg2/package-summary.html\">" +
"pkg2</a> used by <a href=\"../pkg1/package-summary.html\">pkg1</a>" +
"</span><span class=\"tabEnd\">&nbsp;</span></caption>"
},
checkOutput("pkg1/package-use.html", true,
"<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use "
+ "table, listing packages, and an explanation\">",
"<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use "
+ "table, listing classes, and an explanation\">");
checkOutput("pkg2/package-use.html", true,
"<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use "
+ "table, listing packages, and an explanation\">",
"<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use "
+ "table, listing classes, and an explanation\">");
// Deprecated
{ "deprecated-list.html",
"<caption><span>Deprecated Fields</span><span class=\"tabEnd\">" +
"&nbsp;</span></caption>"
},
{ "deprecated-list.html",
"<caption><span>Deprecated Methods</span><span class=\"tabEnd\">" +
"&nbsp;</span></caption>"
},
checkOutput("deprecated-list.html", true,
"<table class=\"deprecatedSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" "
+ "summary=\"Deprecated Fields table, listing deprecated fields, "
+ "and an explanation\">",
"<table class=\"deprecatedSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" "
+ "summary=\"Deprecated Methods table, listing deprecated methods, "
+ "and an explanation\">");
// Constant values
{ "constant-values.html",
"<caption><span>pkg1.<a href=\"pkg1/C1.html\" title=\"class in pkg1\">" +
"C1</a></span><span class=\"tabEnd\">&nbsp;</span></caption>"
},
checkOutput("constant-values.html", true,
"<table class=\"constantsSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" "
+ "summary=\"Constant Field Values table, listing "
+ "constant fields, and values\">");
// Overview Summary
{ "overview-summary.html",
"<caption><span>Packages</span><span class=\"tabEnd\">&nbsp;</span></caption>"
},
checkOutput("overview-summary.html", true,
"<table class=\"overviewSummary\" border=\"0\" cellpadding=\"3\" "
+ "cellspacing=\"0\" summary=\"Packages table, "
+ "listing packages, and an explanation\">");
}
/*
* Tests for validating caption for HTML tables
*/
void checkHtmlTableCaptions() {
//Package summary
checkOutput("pkg1/package-summary.html", true,
"<caption><span>Class Summary</span><span class=\"tabEnd\">"
+ "&nbsp;</span></caption>",
"<caption><span>Interface Summary</span><span class=\"tabEnd\">"
+ "&nbsp;</span></caption>");
checkOutput("pkg2/package-summary.html", true,
"<caption><span>Enum Summary</span><span class=\"tabEnd\">"
+ "&nbsp;</span></caption>",
"<caption><span>Annotation Types Summary</span><span class=\"tabEnd\">"
+ "&nbsp;</span></caption>");
// Class documentation
checkOutput("pkg1/C1.html", true,
"<caption><span>Fields</span><span class=\"tabEnd\">&nbsp;</span></caption>",
"<caption><span id=\"t0\" class=\"activeTableTab\"><span>All "
+ "Methods</span><span class=\"tabEnd\">&nbsp;</span></span>"
+ "<span id=\"t2\" class=\"tableTab\"><span><a href=\"javascript:show(2);\">"
+ "Instance Methods</a></span><span class=\"tabEnd\">&nbsp;</span></span>"
+ "<span id=\"t4\" class=\"tableTab\"><span><a href=\"javascript:show(8);\">"
+ "Concrete Methods</a></span><span class=\"tabEnd\">&nbsp;</span></span>"
+ "<span id=\"t6\" class=\"tableTab\"><span><a href=\"javascript:show(32);\">"
+ "Deprecated Methods</a></span><span class=\"tabEnd\">&nbsp;</span></span>"
+ "</caption>");
checkOutput("pkg2/C2.html", true,
"<caption><span>Nested Classes</span><span class=\"tabEnd\">&nbsp;</span></caption>",
"<caption><span>Constructors</span><span class=\"tabEnd\">&nbsp;</span></caption>");
checkOutput("pkg2/C2.ModalExclusionType.html", true,
"<caption><span>Enum Constants</span><span class=\"tabEnd\">&nbsp;</span></caption>");
checkOutput("pkg2/C3.html", true,
"<caption><span>Required Elements</span><span class=\"tabEnd\">&nbsp;"
+ "</span></caption>");
checkOutput("pkg2/C4.html", true,
"<caption><span>Optional Elements</span><span class=\"tabEnd\">&nbsp;"
+ "</span></caption>");
// Class use documentation
checkOutput("pkg1/class-use/I1.html", true,
"<caption><span>Packages that use <a href=\"../../pkg1/I1.html\" "
+ "title=\"interface in pkg1\">I1</a></span><span class=\"tabEnd\">"
+ "&nbsp;</span></caption>");
checkOutput("pkg1/class-use/C1.html", true,
"<caption><span>Fields in <a href=\"../../pkg2/package-summary.html\">"
+ "pkg2</a> declared as <a href=\"../../pkg1/C1.html\" "
+ "title=\"class in pkg1\">C1</a></span><span class=\"tabEnd\">&nbsp;"
+ "</span></caption>",
"<caption><span>Methods in <a href=\"../../pkg2/package-summary.html\">"
+ "pkg2</a> that return <a href=\"../../pkg1/C1.html\" "
+ "title=\"class in pkg1\">C1</a></span><span class=\"tabEnd\">"
+ "&nbsp;</span></caption>");
checkOutput("pkg2/class-use/C2.html", true,
"<caption><span>Fields in <a href=\"../../pkg1/package-summary.html\">"
+ "pkg1</a> declared as <a href=\"../../pkg2/C2.html\" "
+ "title=\"class in pkg2\">C2</a></span><span class=\"tabEnd\">"
+ "&nbsp;</span></caption>",
"<caption><span>Methods in <a href=\"../../pkg1/package-summary.html\">"
+ "pkg1</a> that return <a href=\"../../pkg2/C2.html\" "
+ "title=\"class in pkg2\">C2</a></span><span class=\"tabEnd\">"
+ "&nbsp;</span></caption>");
checkOutput("pkg2/class-use/C2.ModalExclusionType.html", true,
"<caption><span>Methods in <a href=\"../../pkg2/package-summary.html\">"
+ "pkg2</a> that return <a href=\"../../pkg2/C2.ModalExclusionType.html\" "
+ "title=\"enum in pkg2\">C2.ModalExclusionType</a></span>"
+ "<span class=\"tabEnd\">&nbsp;</span></caption>");
// Package use documentation
checkOutput("pkg1/package-use.html", true,
"<caption><span>Packages that use <a href=\"../pkg1/package-summary.html\">"
+ "pkg1</a></span><span class=\"tabEnd\">&nbsp;</span></caption>",
"<caption><span>Classes in <a href=\"../pkg1/package-summary.html\">"
+ "pkg1</a> used by <a href=\"../pkg1/package-summary.html\">pkg1</a>"
+ "</span><span class=\"tabEnd\">&nbsp;</span></caption>");
checkOutput("pkg2/package-use.html", true,
"<caption><span>Packages that use <a href=\"../pkg2/package-summary.html\">"
+ "pkg2</a></span><span class=\"tabEnd\">&nbsp;</span></caption>",
"<caption><span>Classes in <a href=\"../pkg2/package-summary.html\">"
+ "pkg2</a> used by <a href=\"../pkg1/package-summary.html\">pkg1</a>"
+ "</span><span class=\"tabEnd\">&nbsp;</span></caption>");
// Deprecated
checkOutput("deprecated-list.html", true,
"<caption><span>Deprecated Fields</span><span class=\"tabEnd\">"
+ "&nbsp;</span></caption>",
"<caption><span>Deprecated Methods</span><span class=\"tabEnd\">"
+ "&nbsp;</span></caption>");
// Constant values
checkOutput("constant-values.html", true,
"<caption><span>pkg1.<a href=\"pkg1/C1.html\" title=\"class in pkg1\">"
+ "C1</a></span><span class=\"tabEnd\">&nbsp;</span></caption>");
// Overview Summary
checkOutput("overview-summary.html", true,
"<caption><span>Packages</span><span class=\"tabEnd\">&nbsp;</span></caption>");
}
/*
* Test for validating headers for HTML tables
*/
void checkHtmlTableHeaders() {
//Package summary
{ "pkg1/package-summary.html",
"<th class=\"colFirst\" scope=\"col\">" +
"Class</th>\n" +
"<th class=\"colLast\" scope=\"col\"" +
">Description</th>"
},
{ "pkg1/package-summary.html",
"<th class=\"colFirst\" scope=\"col\">" +
"Interface</th>\n" +
"<th class=\"colLast\" scope=\"col\"" +
">Description</th>"
},
{ "pkg2/package-summary.html",
"<th class=\"colFirst\" scope=\"col\">" +
"Enum</th>\n" +
"<th class=\"colLast\" scope=\"col\"" +
">Description</th>"
},
{ "pkg2/package-summary.html",
"<th class=\"colFirst\" scope=\"col\">" +
"Annotation Type</th>\n" +
"<th class=\"colLast\"" +
" scope=\"col\">Description</th>"
},
// Class documentation
{ "pkg1/C1.html",
"<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n" +
"<th class=\"colLast\" scope=\"col\">Field and Description</th>"
},
{ "pkg1/C1.html",
"<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n" +
"<th class=\"colLast\" scope=\"col\">Method and Description</th>"
},
{ "pkg2/C2.html",
"<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n" +
"<th class=\"colLast\" scope=\"col\">Class and Description</th>"
},
{ "pkg2/C2.html",
"<th class=\"colOne\" scope=\"col\">Constructor and Description</th>"
},
{ "pkg2/C2.ModalExclusionType.html",
"<th class=\"colOne\" scope=\"col\">Enum Constant and Description</th>"
},
{ "pkg2/C3.html",
"<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n" +
"<th class=\"colLast\" scope=\"col\">Required Element and Description</th>"
},
{ "pkg2/C4.html",
"<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n" +
"<th class=\"colLast\" scope=\"col\">Optional Element and Description</th>"
},
// Class use documentation
{ "pkg1/class-use/I1.html",
"<th class=\"colFirst\" scope=\"col\">Package</th>\n" +
"<th class=\"colLast\" scope=\"col\">Description</th>"
},
{ "pkg1/class-use/C1.html",
"<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n" +
"<th class=\"colLast\" scope=\"col\">Field and Description</th>"
},
{ "pkg1/class-use/C1.html",
"<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n" +
"<th class=\"colLast\" scope=\"col\">Method and Description</th>"
},
{ "pkg2/class-use/C2.html",
"<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n" +
"<th class=\"colLast\" scope=\"col\">Field and Description</th>"
},
{ "pkg2/class-use/C2.html",
"<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n" +
"<th class=\"colLast\" scope=\"col\">Method and Description</th>"
},
{ "pkg2/class-use/C2.ModalExclusionType.html",
"<th class=\"colFirst\" scope=\"col\">Package</th>\n" +
"<th class=\"colLast\" scope=\"col\">Description</th>"
},
{ "pkg2/class-use/C2.ModalExclusionType.html",
"<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n" +
"<th class=\"colLast\" scope=\"col\">Method and Description</th>"
},
// Package use documentation
{ "pkg1/package-use.html",
"<th class=\"colFirst\" scope=\"col\">Package</th>\n" +
"<th class=\"colLast\" scope=\"col\">Description</th>"
},
{ "pkg1/package-use.html",
"<th class=\"colOne\" scope=\"col\">Class and Description</th>"
},
{ "pkg2/package-use.html",
"<th class=\"colFirst\" scope=\"col\">Package</th>\n" +
"<th class=\"colLast\" scope=\"col\">Description</th>"
},
{ "pkg2/package-use.html",
"<th class=\"colOne\" scope=\"col\">Class and Description</th>"
},
// Deprecated
{ "deprecated-list.html",
"<th class=\"colOne\" scope=\"col\">Field and Description</th>"
},
{ "deprecated-list.html",
"<th class=\"colOne\" scope=\"col\">Method and Description</th>"
},
// Constant values
{ "constant-values.html",
"<th class=\"colFirst\" scope=\"col\">" +
"Modifier and Type</th>\n" +
"<th" +
" scope=\"col\">Constant Field</th>\n" +
"<th class=\"colLast\" scope=\"col\">Value</th>"
},
// Overview Summary
{ "overview-summary.html",
"<th class=\"colFirst\" scope=\"col\">" +
"Package</th>\n" +
"<th class=\"colLast\" scope=\"col\"" +
">Description</th>"
}
};
checkOutput("pkg1/package-summary.html", true,
"<th class=\"colFirst\" scope=\"col\">"
+ "Class</th>\n"
+ "<th class=\"colLast\" scope=\"col\""
+ ">Description</th>",
"<th class=\"colFirst\" scope=\"col\">"
+ "Interface</th>\n"
+ "<th class=\"colLast\" scope=\"col\""
+ ">Description</th>");
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
TestHtmlTableTags tester = new TestHtmlTableTags();
tester.run(ARGS, TABLE_TAGS_TEST, NO_TEST);
tester.printSummary();
checkOutput("pkg2/package-summary.html", true,
"<th class=\"colFirst\" scope=\"col\">"
+ "Enum</th>\n"
+ "<th class=\"colLast\" scope=\"col\""
+ ">Description</th>",
"<th class=\"colFirst\" scope=\"col\">"
+ "Annotation Type</th>\n"
+ "<th class=\"colLast\""
+ " scope=\"col\">Description</th>");
// Class documentation
checkOutput("pkg1/C1.html", true,
"<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n"
+ "<th class=\"colLast\" scope=\"col\">Field and Description</th>",
"<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n"
+ "<th class=\"colLast\" scope=\"col\">Method and Description</th>");
checkOutput("pkg2/C2.html", true,
"<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n"
+ "<th class=\"colLast\" scope=\"col\">Class and Description</th>",
"<th class=\"colOne\" scope=\"col\">Constructor and Description</th>");
checkOutput("pkg2/C2.ModalExclusionType.html", true,
"<th class=\"colOne\" scope=\"col\">Enum Constant and Description</th>");
checkOutput("pkg2/C3.html", true,
"<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n"
+ "<th class=\"colLast\" scope=\"col\">Required Element and Description</th>");
checkOutput("pkg2/C4.html", true,
"<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n"
+ "<th class=\"colLast\" scope=\"col\">Optional Element and Description</th>");
// Class use documentation
checkOutput("pkg1/class-use/I1.html", true,
"<th class=\"colFirst\" scope=\"col\">Package</th>\n"
+ "<th class=\"colLast\" scope=\"col\">Description</th>");
checkOutput("pkg1/class-use/C1.html", true,
"<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n"
+ "<th class=\"colLast\" scope=\"col\">Field and Description</th>",
"<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n"
+ "<th class=\"colLast\" scope=\"col\">Method and Description</th>");
checkOutput("pkg2/class-use/C2.html", true,
"<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n"
+ "<th class=\"colLast\" scope=\"col\">Field and Description</th>",
"<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n"
+ "<th class=\"colLast\" scope=\"col\">Method and Description</th>");
checkOutput("pkg2/class-use/C2.ModalExclusionType.html", true,
"<th class=\"colFirst\" scope=\"col\">Package</th>\n"
+ "<th class=\"colLast\" scope=\"col\">Description</th>",
"<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n"
+ "<th class=\"colLast\" scope=\"col\">Method and Description</th>");
// Package use documentation
checkOutput("pkg1/package-use.html", true,
"<th class=\"colFirst\" scope=\"col\">Package</th>\n"
+ "<th class=\"colLast\" scope=\"col\">Description</th>",
"<th class=\"colOne\" scope=\"col\">Class and Description</th>");
checkOutput("pkg2/package-use.html", true,
"<th class=\"colFirst\" scope=\"col\">Package</th>\n"
+ "<th class=\"colLast\" scope=\"col\">Description</th>",
"<th class=\"colOne\" scope=\"col\">Class and Description</th>");
// Deprecated
checkOutput("deprecated-list.html", true,
"<th class=\"colOne\" scope=\"col\">Field and Description</th>",
"<th class=\"colOne\" scope=\"col\">Method and Description</th>");
// Constant values
checkOutput("constant-values.html", true,
"<th class=\"colFirst\" scope=\"col\">"
+ "Modifier and Type</th>\n"
+ "<th"
+ " scope=\"col\">Constant Field</th>\n"
+ "<th class=\"colLast\" scope=\"col\">Value</th>");
// Overview Summary
checkOutput("overview-summary.html", true,
"<th class=\"colFirst\" scope=\"col\">"
+ "Package</th>\n"
+ "<th class=\"colLast\" scope=\"col\""
+ ">Description</th>");
}
}

View file

@ -28,9 +28,8 @@
* @bug 6786682
* @summary This test verifies the use of lang attribute by <HTML>.
* @author Bhavesh Patel
* @library ../lib/
* @library ../lib
* @build JavadocTester
* @build TestHtmlTag
* @run main TestHtmlTag
*/
@ -38,43 +37,65 @@ import java.util.Locale;
public class TestHtmlTag extends JavadocTester {
private static final String[][] TEST1 = {
{ "pkg1/C1.html",
"<html lang=\"" + Locale.getDefault().getLanguage() + "\">"},
{ "pkg1/package-summary.html",
"<html lang=\"" + Locale.getDefault().getLanguage() + "\">"}};
private static final String[][] NEGATED_TEST1 = {
{ "pkg1/C1.html", "<html>"}};
private static final String[][] TEST2 = {
{ "pkg2/C2.html", "<html lang=\"ja\">"},
{ "pkg2/package-summary.html", "<html lang=\"ja\">"}};
private static final String[][] NEGATED_TEST2 = {
{ "pkg2/C2.html", "<html>"}};
private static final String[][] TEST3 = {
{ "pkg1/C1.html", "<html lang=\"en\">"},
{ "pkg1/package-summary.html", "<html lang=\"en\">"}};
private static final String[][] NEGATED_TEST3 = {
{ "pkg1/C1.html", "<html>"}};
private static final String[] ARGS1 =
new String[] {
"-d", OUTPUT_DIR + "-1", "-sourcepath", SRC_DIR, "pkg1"};
private static final String[] ARGS2 =
new String[] {
"-locale", "ja", "-d", OUTPUT_DIR + "-2", "-sourcepath", SRC_DIR, "pkg2"};
private static final String[] ARGS3 =
new String[] {
"-locale", "en_US", "-d", OUTPUT_DIR + "-3", "-sourcepath", SRC_DIR, "pkg1"};
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
public static void main(String... args) throws Exception {
TestHtmlTag tester = new TestHtmlTag();
tester.run(ARGS1, TEST1, NEGATED_TEST1);
tester.run(ARGS2, TEST2, NEGATED_TEST2);
tester.run(ARGS3, TEST3, NEGATED_TEST3);
tester.printSummary();
tester.runTests();
}
@Test
void test_default() {
javadoc("-d", "out-default",
"-sourcepath", testSrc,
"pkg1");
checkExit(Exit.OK);
String defaultLanguage = Locale.getDefault().getLanguage();
checkOutput("pkg1/C1.html", true,
"<html lang=\"" + defaultLanguage + "\">");
checkOutput("pkg1/package-summary.html", true,
"<html lang=\"" + defaultLanguage + "\">");
checkOutput("pkg1/C1.html", false,
"<html>");
}
@Test
void test_ja() {
// TODO: why does this test need/use pkg2; why can't it use pkg1
// like the other two tests, so that we can share the check methods?
javadoc("-locale", "ja",
"-d", "out-ja",
"-sourcepath", testSrc,
"pkg2");
checkExit(Exit.OK);
checkOutput("pkg2/C2.html", true,
"<html lang=\"ja\">");
checkOutput("pkg2/package-summary.html", true,
"<html lang=\"ja\">");
checkOutput("pkg2/C2.html", false,
"<html>");
}
@Test
void test_en_US() {
javadoc("-locale", "en_US",
"-d", "out-en_US",
"-sourcepath", testSrc,
"pkg1");
checkExit(Exit.OK);
checkOutput("pkg1/C1.html", true,
"<html lang=\"en\">");
checkOutput("pkg1/package-summary.html", true,
"<html lang=\"en\">");
checkOutput("pkg1/C1.html", false,
"<html>");
}
}

View file

@ -25,37 +25,30 @@
* @test
* @bug 8011288
* @summary Erratic/inconsistent indentation of signatures
* @library ../lib/
* @library ../lib
* @build JavadocTester
* @run main TestIndentation
*/
public class TestIndentation extends JavadocTester {
//Javadoc arguments.
private static final String[] ARGS = new String[] {
"-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "p"
};
//Input for string search tests.
private static final String[][] TEST = {
{ "p/Indent.html",
"<pre>public&nbsp;&lt;T&gt;&nbsp;void&nbsp;m(T&nbsp;t1," },
{ "p/Indent.html",
"\n" +
" T&nbsp;t2)" },
{ "p/Indent.html",
"\n" +
" throws java.lang.Exception" }
};
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
public static void main(String... args) throws Exception {
TestIndentation tester = new TestIndentation();
tester.run(ARGS, TEST, NO_TEST);
tester.printSummary();
tester.runTests();
}
@Test
void test() {
javadoc("-d", "out",
"-sourcepath", testSrc,
"p");
checkExit(Exit.OK);
checkOutput("p/Indent.html", true,
"<pre>public&nbsp;&lt;T&gt;&nbsp;void&nbsp;m(T&nbsp;t1,",
"\n"
+ " T&nbsp;t2)",
"\n"
+ " throws java.lang.Exception");
}
}

View file

@ -28,64 +28,53 @@
* Also test that index-all.html has the appropriate output.
* Test for unnamed package in index.
* @author jamieh
* @library ../lib/
* @library ../lib
* @build JavadocTester
* @build TestIndex
* @run main TestIndex
*/
public class TestIndex extends JavadocTester {
//Javadoc arguments.
private static final String[] ARGS = new String[] {
"-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg", SRC_DIR + "/NoPackage.java"
};
public static void main(String... args) throws Exception {
TestIndex tester = new TestIndex();
tester.runTests();
}
@Test
void test() {
javadoc("-d", "out",
"-sourcepath", testSrc,
"pkg", testSrc("NoPackage.java"));
checkExit(Exit.OK);
//Input for string search tests.
private static final String[][] TEST = {
//Make sure the horizontal scroll bar does not appear in class frame.
{ "index.html",
"<frame src=\"overview-summary.html\" name=\"classFrame\" title=\"" +
"Package, class and interface descriptions\" scrolling=\"yes\">"},
checkOutput("index.html", true,
"<frame src=\"overview-summary.html\" name=\"classFrame\" title=\""
+ "Package, class and interface descriptions\" scrolling=\"yes\">");
//Test index-all.html
{ "index-all.html",
"<a href=\"pkg/C.html\" title=\"class in pkg\"><span class=\"typeNameLink\">C</span></a>" +
" - Class in <a href=\"pkg/package-summary.html\">pkg</a>"},
{ "index-all.html",
"<a href=\"pkg/Interface.html\" title=\"interface in pkg\">" +
"<span class=\"typeNameLink\">Interface</span></a> - Interface in " +
"<a href=\"pkg/package-summary.html\">pkg</a>"},
{ "index-all.html",
"<a href=\"pkg/AnnotationType.html\" title=\"annotation in pkg\">" +
"<span class=\"typeNameLink\">AnnotationType</span></a> - Annotation Type in " +
"<a href=\"pkg/package-summary.html\">pkg</a>"},
{ "index-all.html",
"<a href=\"pkg/Coin.html\" title=\"enum in pkg\">" +
"<span class=\"typeNameLink\">Coin</span></a> - Enum in " +
"<a href=\"pkg/package-summary.html\">pkg</a>"},
{ "index-all.html",
"Class in <a href=\"package-summary.html\">&lt;Unnamed&gt;</a>"},
{ "index-all.html",
"<dl>\n" +
"<dt><span class=\"memberNameLink\"><a href=\"pkg/C.html#Java\">" +
"Java</a></span> - Static variable in class pkg.<a href=\"pkg/C.html\" " +
"title=\"class in pkg\">C</a></dt>\n" +
"<dd>&nbsp;</dd>\n" +
"<dt><span class=\"memberNameLink\"><a href=\"pkg/C.html#JDK\">JDK</a></span> " +
"- Static variable in class pkg.<a href=\"pkg/C.html\" title=\"class in pkg\">" +
"C</a></dt>\n" +
"<dd>&nbsp;</dd>\n" +
"</dl>"},
};
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
TestIndex tester = new TestIndex();
tester.run(ARGS, TEST, NO_TEST);
tester.printSummary();
checkOutput("index-all.html", true,
"<a href=\"pkg/C.html\" title=\"class in pkg\"><span class=\"typeNameLink\">C</span></a>"
+ " - Class in <a href=\"pkg/package-summary.html\">pkg</a>",
"<a href=\"pkg/Interface.html\" title=\"interface in pkg\">"
+ "<span class=\"typeNameLink\">Interface</span></a> - Interface in "
+ "<a href=\"pkg/package-summary.html\">pkg</a>",
"<a href=\"pkg/AnnotationType.html\" title=\"annotation in pkg\">"
+ "<span class=\"typeNameLink\">AnnotationType</span></a> - Annotation Type in "
+ "<a href=\"pkg/package-summary.html\">pkg</a>",
"<a href=\"pkg/Coin.html\" title=\"enum in pkg\">"
+ "<span class=\"typeNameLink\">Coin</span></a> - Enum in "
+ "<a href=\"pkg/package-summary.html\">pkg</a>",
"Class in <a href=\"package-summary.html\">&lt;Unnamed&gt;</a>",
"<dl>\n"
+ "<dt><span class=\"memberNameLink\"><a href=\"pkg/C.html#Java\">"
+ "Java</a></span> - Static variable in class pkg.<a href=\"pkg/C.html\" "
+ "title=\"class in pkg\">C</a></dt>\n"
+ "<dd>&nbsp;</dd>\n"
+ "<dt><span class=\"memberNameLink\"><a href=\"pkg/C.html#JDK\">JDK</a></span> "
+ "- Static variable in class pkg.<a href=\"pkg/C.html\" title=\"class in pkg\">"
+ "C</a></dt>\n"
+ "<dd>&nbsp;</dd>\n"
+ "</dl>");
}
}

View file

@ -26,34 +26,29 @@
* @bug 4524136
* @summary Test to make sure label is used for inline links.
* @author jamieh
* @library ../lib/
* @library ../lib
* @build JavadocTester
* @build TestInlineLinkLabel
* @run main TestInlineLinkLabel
*/
public class TestInlineLinkLabel extends JavadocTester {
private static final String[][] TEST = {
//Search for the label to the package link.
{ "pkg/C1.html" ,
"<a href=\"../pkg/package-summary.html\"><code>Here is a link to a package</code></a>"},
//Search for the label to the class link
{ "pkg/C1.html" ,
"<a href=\"../pkg/C2.html\" title=\"class in pkg\"><code>Here is a link to a class</code></a>"}
};
private static final String[] ARGS =
new String[] {
"-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg"};
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
public static void main(String... args) throws Exception {
TestInlineLinkLabel tester = new TestInlineLinkLabel();
tester.run(ARGS, TEST, NO_TEST);
tester.printSummary();
tester.runTests();
}
@Test
void test() {
javadoc("-d", "out",
"-sourcepath", testSrc,
"pkg");
checkExit(Exit.OK);
checkOutput("pkg/C1.html", true,
//Search for the label to the package link.
"<a href=\"../pkg/package-summary.html\"><code>Here is a link to a package</code></a>",
//Search for the label to the class link
"<a href=\"../pkg/C2.html\" title=\"class in pkg\"><code>Here is a link to a class</code></a>");
}
}

View file

@ -29,101 +29,82 @@
* If A implements I and B extends A, B should be in the list of
* implementing classes in the documentation for I.
* @author jamieh
* @library ../lib/
* @library ../lib
* @build JavadocTester
* @build TestInterface
* @run main TestInterface
*/
public class TestInterface extends JavadocTester {
//Javadoc arguments.
private static final String[] ARGS = new String[] {
"-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg"
};
//Input for string search tests.
private static final String[][] TEST = {
{ "pkg/Interface.html",
"<pre>int&nbsp;method()</pre>"},
{ "pkg/Interface.html",
"<pre>static final&nbsp;int field</pre>"},
// Make sure known implementing class list is correct and omits type parameters.
{ "pkg/Interface.html",
"<dl>\n" +
"<dt>All Known Implementing Classes:</dt>\n" +
"<dd><a href=\"../pkg/Child.html\" title=\"class in pkg\">Child" +
"</a>, <a href=\"../pkg/Parent.html\" title=\"class in pkg\">Parent" +
"</a></dd>\n" +
"</dl>"},
// Make sure "All Implemented Interfaces": has substituted type parameters
{ "pkg/Child.html",
"<dl>\n" +
"<dt>All Implemented Interfaces:</dt>\n" +
"<dd><a href=\"../pkg/Interface.html\" title=\"interface in pkg\">" +
"Interface</a>&lt;T&gt;</dd>\n" +
"</dl>"
},
//Make sure Class Tree has substituted type parameters.
{ "pkg/Child.html",
"<ul class=\"inheritance\">\n" +
"<li>java.lang.Object</li>\n" +
"<li>\n" +
"<ul class=\"inheritance\">\n" +
"<li><a href=\"../pkg/Parent.html\" title=\"class in pkg\">" +
"pkg.Parent</a>&lt;T&gt;</li>\n" +
"<li>\n" +
"<ul class=\"inheritance\">\n" +
"<li>pkg.Child&lt;T&gt;</li>\n" +
"</ul>\n" +
"</li>\n" +
"</ul>\n" +
"</li>\n" +
"</ul>"
},
//Make sure "Direct Know Subclasses" omits type parameters
{ "pkg/Parent.html",
"<dl>\n" +
"<dt>Direct Known Subclasses:</dt>\n" +
"<dd><a href=\"../pkg/Child.html\" title=\"class in pkg\">Child" +
"</a></dd>\n" +
"</dl>"
},
//Make sure "Specified By" has substituted type parameters.
{ "pkg/Child.html",
"<dt><span class=\"overrideSpecifyLabel\">Specified by:</span></dt>\n" +
"<dd><code><a href=\"../pkg/Interface.html#method--\">method</a>" +
"</code>&nbsp;in interface&nbsp;<code>" +
"<a href=\"../pkg/Interface.html\" title=\"interface in pkg\">" +
"Interface</a>&lt;<a href=\"../pkg/Child.html\" title=\"type parameter in Child\">" +
"T</a>&gt;</code></dd>"
},
//Make sure "Overrides" has substituted type parameters.
{ "pkg/Child.html",
"<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n" +
"<dd><code><a href=\"../pkg/Parent.html#method--\">method</a>" +
"</code>&nbsp;in class&nbsp;<code><a href=\"../pkg/Parent.html\" " +
"title=\"class in pkg\">Parent</a>&lt;<a href=\"../pkg/Child.html\" " +
"title=\"type parameter in Child\">T</a>&gt;</code></dd>"
},
};
private static final String[][] NEGATED_TEST = {
{ "pkg/Interface.html",
"public int&nbsp;method()"},
{ "pkg/Interface.html",
"public static final&nbsp;int field"},
};
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
public static void main(String... args) throws Exception {
TestInterface tester = new TestInterface();
tester.run(ARGS, TEST, NEGATED_TEST);
tester.printSummary();
tester.runTests();
}
@Test
void test() {
javadoc("-d", "out",
"-sourcepath", testSrc,
"pkg");
checkExit(Exit.OK);
checkOutput("pkg/Interface.html", true,
"<pre>int&nbsp;method()</pre>",
"<pre>static final&nbsp;int field</pre>",
// Make sure known implementing class list is correct and omits type parameters.
"<dl>\n"
+ "<dt>All Known Implementing Classes:</dt>\n"
+ "<dd><a href=\"../pkg/Child.html\" title=\"class in pkg\">Child"
+ "</a>, <a href=\"../pkg/Parent.html\" title=\"class in pkg\">Parent"
+ "</a></dd>\n"
+ "</dl>");
checkOutput("pkg/Child.html", true,
// Make sure "All Implemented Interfaces": has substituted type parameters
"<dl>\n"
+ "<dt>All Implemented Interfaces:</dt>\n"
+ "<dd><a href=\"../pkg/Interface.html\" title=\"interface in pkg\">"
+ "Interface</a>&lt;T&gt;</dd>\n"
+ "</dl>",
//Make sure Class Tree has substituted type parameters.
"<ul class=\"inheritance\">\n"
+ "<li>java.lang.Object</li>\n"
+ "<li>\n"
+ "<ul class=\"inheritance\">\n"
+ "<li><a href=\"../pkg/Parent.html\" title=\"class in pkg\">"
+ "pkg.Parent</a>&lt;T&gt;</li>\n"
+ "<li>\n"
+ "<ul class=\"inheritance\">\n"
+ "<li>pkg.Child&lt;T&gt;</li>\n"
+ "</ul>\n"
+ "</li>\n"
+ "</ul>\n"
+ "</li>\n"
+ "</ul>",
//Make sure "Specified By" has substituted type parameters.
"<dt><span class=\"overrideSpecifyLabel\">Specified by:</span></dt>\n"
+ "<dd><code><a href=\"../pkg/Interface.html#method--\">method</a>"
+ "</code>&nbsp;in interface&nbsp;<code>"
+ "<a href=\"../pkg/Interface.html\" title=\"interface in pkg\">"
+ "Interface</a>&lt;<a href=\"../pkg/Child.html\" title=\"type parameter in Child\">"
+ "T</a>&gt;</code></dd>",
//Make sure "Overrides" has substituted type parameters.
"<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n"
+ "<dd><code><a href=\"../pkg/Parent.html#method--\">method</a>"
+ "</code>&nbsp;in class&nbsp;<code><a href=\"../pkg/Parent.html\" "
+ "title=\"class in pkg\">Parent</a>&lt;<a href=\"../pkg/Child.html\" "
+ "title=\"type parameter in Child\">T</a>&gt;</code></dd>");
checkOutput("pkg/Parent.html", true,
//Make sure "Direct Know Subclasses" omits type parameters
"<dl>\n"
+ "<dt>Direct Known Subclasses:</dt>\n"
+ "<dd><a href=\"../pkg/Child.html\" title=\"class in pkg\">Child"
+ "</a></dd>\n"
+ "</dl>");
checkOutput("pkg/Interface.html", false,
"public int&nbsp;method()",
"public static final&nbsp;int field");
}
}

View file

@ -26,73 +26,57 @@
* @bug 7112427 8012295 8025633 8026567
* @summary Test of the JavaFX doclet features.
* @author jvalenta
* @library ../lib/
* @build JavadocTester TestJavaFX
* @library ../lib
* @build JavadocTester
* @run main TestJavaFX
*/
public class TestJavaFX extends JavadocTester {
private static final String[][] TEST =
new String[][] {
{ "C.html",
"<dt><span class=\"seeLabel\">See Also:</span></dt>\n" +
"<dd><a href=\"C.html#getRate--\"><code>getRate()</code></a>, \n" +
"<a href=\"C.html#setRate-double-\"><code>setRate(double)</code></a></dd>"},
{ "C.html",
"<pre>public final&nbsp;void&nbsp;setRate(double&nbsp;value)</pre>\n" +
"<div class=\"block\">Sets the value of the property rate.</div>\n" +
"<dl>\n" +
"<dt><span class=\"simpleTagLabel\">Property description:</span></dt>" },
{ "C.html",
"<pre>public final&nbsp;double&nbsp;getRate()</pre>\n" +
"<div class=\"block\">Gets the value of the property rate.</div>\n" +
"<dl>\n" +
"<dt><span class=\"simpleTagLabel\">Property description:</span></dt>" },
{ "C.html",
"<td class=\"colLast\"><code><span class=\"memberNameLink\"><a href=\"C.html#rateProperty\">rate</a></span></code>\n" +
"<div class=\"block\">Defines the direction/speed at which the <code>Timeline</code> is expected to"},
{ "C.html",
"<span class=\"simpleTagLabel\">Default value:</span>"},
{ "C.html",
"<span class=\"simpleTagLabel\">Since:</span></dt>\n" +
"<dd>JavaFX 8.0</dd>" },
{ "C.html",
"<p>Sets the value of the property <code>Property</code>"},
{ "C.html",
"<p>Gets the value of the property <code>Property</code>"},
{ "C.html",
"<span class=\"simpleTagLabel\">Property description:</span>"},
{ "C.html",
"<td class=\"colLast\"><code><span class=\"memberNameLink\"><a href=\"C.html#setTestMethodProperty--\">setTestMethodProperty</a></span>()</code>&nbsp;</td>" },
{ "C.html",
"<h4>isPaused</h4>\n" +
"<pre>public final&nbsp;double&nbsp;isPaused()</pre>\n" +
"<div class=\"block\">Gets the value of the property paused.</div>" },
{ "D.html",
"<h3>Properties inherited from class&nbsp;<a href=\"C.html\" title=\"class in &lt;Unnamed&gt;\">C</a></h3>\n" +
"<code><a href=\"C.html#pausedProperty\">paused</a>, <a href=\"C.html#rateProperty\">rate</a></code></li>" },
};
private static final String[][] NO_TEST =
new String[][] {
{ "C.html",
"A()"},
};
private static final String[] ARGS = new String[] {
"-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "-javafx",
SRC_DIR + "/C.java", SRC_DIR + "/D.java"
};
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
public static void main(String... args) throws Exception {
TestJavaFX tester = new TestJavaFX();
tester.run(ARGS, TEST, NO_TEST);
tester.printSummary();
tester.runTests();
}
@Test
void test() {
javadoc("-d", "out",
"-sourcepath", testSrc,
"-javafx",
testSrc("C.java"), testSrc("D.java"));
checkExit(Exit.FAILED); // should be EXIT_OK -- need to fix C.java
checkOutput("C.html", true,
"<dt><span class=\"seeLabel\">See Also:</span></dt>\n"
+ "<dd><a href=\"C.html#getRate--\"><code>getRate()</code></a>, \n"
+ "<a href=\"C.html#setRate-double-\"><code>setRate(double)</code></a></dd>",
"<pre>public final&nbsp;void&nbsp;setRate(double&nbsp;value)</pre>\n"
+ "<div class=\"block\">Sets the value of the property rate.</div>\n"
+ "<dl>\n"
+ "<dt><span class=\"simpleTagLabel\">Property description:</span></dt>",
"<pre>public final&nbsp;double&nbsp;getRate()</pre>\n"
+ "<div class=\"block\">Gets the value of the property rate.</div>\n"
+ "<dl>\n"
+ "<dt><span class=\"simpleTagLabel\">Property description:</span></dt>",
"<td class=\"colLast\"><code><span class=\"memberNameLink\"><a href=\"C.html#rateProperty\">rate</a></span></code>\n"
+ "<div class=\"block\">Defines the direction/speed at which the <code>Timeline</code> is expected to",
"<span class=\"simpleTagLabel\">Default value:</span>",
"<span class=\"simpleTagLabel\">Since:</span></dt>\n"
+ "<dd>JavaFX 8.0</dd>",
"<p>Sets the value of the property <code>Property</code>",
"<p>Gets the value of the property <code>Property</code>",
"<span class=\"simpleTagLabel\">Property description:</span>",
"<td class=\"colLast\"><code><span class=\"memberNameLink\"><a href=\"C.html#setTestMethodProperty--\">setTestMethodProperty</a></span>()</code>&nbsp;</td>",
"<h4>isPaused</h4>\n"
+ "<pre>public final&nbsp;double&nbsp;isPaused()</pre>\n"
+ "<div class=\"block\">Gets the value of the property paused.</div>");
checkOutput("C.html", false,
"A()");
checkOutput("D.html", true,
"<h3>Properties inherited from class&nbsp;<a href=\"C.html\" title=\"class in &lt;Unnamed&gt;\">C</a></h3>\n"
+ "<code><a href=\"C.html#pausedProperty\">paused</a>, <a href=\"C.html#rateProperty\">rate</a></code></li>");
}
}

View file

@ -26,98 +26,93 @@
* @bug 4665566 4855876 7025314 8012375 8015997 8016328 8024756
* @summary Verify that the output has the right javascript.
* @author jamieh
* @library ../lib/
* @library ../lib
* @build JavadocTester
* @build TestJavascript
* @run main TestJavascript
*/
public class TestJavascript extends JavadocTester {
//Javadoc arguments.
private static final String[] ARGS = new String[] {
"-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg", SRC_DIR +
"/TestJavascript.java"
};
public static void main(String... args) throws Exception {
TestJavascript tester = new TestJavascript();
tester.runTests();
}
//Input for string search tests.
private static final String[][] TEST = {
{ "pkg/C.html",
"<a href=\"../index.html?pkg/C.html\" target=\"_top\">Frames</a>"},
{ "TestJavascript.html",
"<a href=\"index.html?TestJavascript.html\" target=\"_top\">Frames</a>"},
{ "index.html",
"<script type=\"text/javascript\">\n" +
" targetPage = \"\" + window.location.search;\n" +
" if (targetPage != \"\" && targetPage != \"undefined\")\n" +
" targetPage = targetPage.substring(1);\n" +
" if (targetPage.indexOf(\":\") != -1 || (targetPage != \"\" && !validURL(targetPage)))\n" +
" targetPage = \"undefined\";\n" +
" function validURL(url) {\n" +
" try {\n" +
" url = decodeURIComponent(url);\n" +
" }\n" +
" catch (error) {\n" +
" return false;\n" +
" }\n" +
" var pos = url.indexOf(\".html\");\n" +
" if (pos == -1 || pos != url.length - 5)\n" +
" return false;\n" +
" var allowNumber = false;\n" +
" var allowSep = false;\n" +
" var seenDot = false;\n" +
" for (var i = 0; i < url.length - 5; i++) {\n" +
" var ch = url.charAt(i);\n" +
" if ('a' <= ch && ch <= 'z' ||\n" +
" 'A' <= ch && ch <= 'Z' ||\n" +
" ch == '$' ||\n" +
" ch == '_' ||\n" +
" ch.charCodeAt(0) > 127) {\n" +
" allowNumber = true;\n" +
" allowSep = true;\n" +
" } else if ('0' <= ch && ch <= '9'\n" +
" || ch == '-') {\n" +
" if (!allowNumber)\n" +
" return false;\n" +
" } else if (ch == '/' || ch == '.') {\n" +
" if (!allowSep)\n" +
" return false;\n" +
" allowNumber = false;\n" +
" allowSep = false;\n" +
" if (ch == '.')\n" +
" seenDot = true;\n" +
" if (ch == '/' && seenDot)\n" +
" return false;\n" +
" } else {\n" +
" return false;\n" +
" }\n" +
" }\n" +
" return true;\n" +
" }\n" +
" function loadFrames() {\n" +
" if (targetPage != \"\" && targetPage != \"undefined\")\n" +
" top.classFrame.location = top.targetPage;\n" +
" }\n" +
"</script>"},
@Test
void test() {
javadoc("-d", "out",
"-sourcepath", testSrc,
"pkg", testSrc("TestJavascript.java"));
checkExit(Exit.OK);
checkOutput("pkg/C.html", true,
"<a href=\"../index.html?pkg/C.html\" target=\"_top\">Frames</a>");
checkOutput("TestJavascript.html", true,
"<a href=\"index.html?TestJavascript.html\" target=\"_top\">Frames</a>");
checkOutput("index.html", true,
"<script type=\"text/javascript\">\n"
+ " targetPage = \"\" + window.location.search;\n"
+ " if (targetPage != \"\" && targetPage != \"undefined\")\n"
+ " targetPage = targetPage.substring(1);\n"
+ " if (targetPage.indexOf(\":\") != -1 || (targetPage != \"\" && !validURL(targetPage)))\n"
+ " targetPage = \"undefined\";\n"
+ " function validURL(url) {\n"
+ " try {\n"
+ " url = decodeURIComponent(url);\n"
+ " }\n"
+ " catch (error) {\n"
+ " return false;\n"
+ " }\n"
+ " var pos = url.indexOf(\".html\");\n"
+ " if (pos == -1 || pos != url.length - 5)\n"
+ " return false;\n"
+ " var allowNumber = false;\n"
+ " var allowSep = false;\n"
+ " var seenDot = false;\n"
+ " for (var i = 0; i < url.length - 5; i++) {\n"
+ " var ch = url.charAt(i);\n"
+ " if ('a' <= ch && ch <= 'z' ||\n"
+ " 'A' <= ch && ch <= 'Z' ||\n"
+ " ch == '$' ||\n"
+ " ch == '_' ||\n"
+ " ch.charCodeAt(0) > 127) {\n"
+ " allowNumber = true;\n"
+ " allowSep = true;\n"
+ " } else if ('0' <= ch && ch <= '9'\n"
+ " || ch == '-') {\n"
+ " if (!allowNumber)\n"
+ " return false;\n"
+ " } else if (ch == '/' || ch == '.') {\n"
+ " if (!allowSep)\n"
+ " return false;\n"
+ " allowNumber = false;\n"
+ " allowSep = false;\n"
+ " if (ch == '.')\n"
+ " seenDot = true;\n"
+ " if (ch == '/' && seenDot)\n"
+ " return false;\n"
+ " } else {\n"
+ " return false;\n"
+ " }\n"
+ " }\n"
+ " return true;\n"
+ " }\n"
+ " function loadFrames() {\n"
+ " if (targetPage != \"\" && targetPage != \"undefined\")\n"
+ " top.classFrame.location = top.targetPage;\n"
+ " }\n"
+ "</script>");
//Make sure title javascript only runs if is-external is not true
{ "pkg/C.html",
" try {\n" +
" if (location.href.indexOf('is-external=true') == -1) {\n" +
" parent.document.title=\"C\";\n" +
" }\n" +
" }\n" +
" catch(err) {\n" +
" }"},
};
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
TestJavascript tester = new TestJavascript();
tester.run(ARGS, TEST, NO_TEST);
tester.printSummary();
checkOutput("pkg/C.html", true,
" try {\n"
+ " if (location.href.indexOf('is-external=true') == -1) {\n"
+ " parent.document.title=\"C\";\n"
+ " }\n"
+ " }\n"
+ " catch(err) {\n"
+ " }");
}
}

View file

@ -40,79 +40,74 @@
public class TestLambdaFeature extends JavadocTester {
//Javadoc arguments.
private static final String[] ARGS = new String[] {
"-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg", "pkg1"
};
private static final String[] ARGS_1 = new String[] {
"-d", OUTPUT_DIR + "-2", "-sourcepath", SRC_DIR, "-source", "1.7", "pkg1"
};
//Input for string search tests.
private static final String[][] TEST = {
{ "pkg/A.html",
"<td class=\"colFirst\"><code>default void</code></td>"},
{ "pkg/A.html",
"<pre>default&nbsp;void&nbsp;defaultMethod()</pre>"},
{ "pkg/A.html",
"<caption><span id=\"t0\" class=\"activeTableTab\"><span>" +
"All Methods</span><span class=\"tabEnd\">&nbsp;</span></span>" +
"<span id=\"t2\" class=\"tableTab\"><span>" +
"<a href=\"javascript:show(2);\">Instance Methods</a></span>" +
"<span class=\"tabEnd\">&nbsp;</span></span><span id=\"t3\" " +
"class=\"tableTab\"><span><a href=\"javascript:show(4);\">" +
"Abstract Methods</a></span><span class=\"tabEnd\">&nbsp;</span>" +
"</span><span id=\"t5\" class=\"tableTab\"><span>" +
"<a href=\"javascript:show(16);\">Default Methods</a></span>" +
"<span class=\"tabEnd\">&nbsp;</span></span></caption>"},
{ "pkg/A.html",
"<dl>\n" +
"<dt>Functional Interface:</dt>\n" +
"<dd>This is a functional interface and can therefore be used as " +
"the assignment target for a lambda expression or method " +
"reference.</dd>\n" +
"</dl>"},
{ "pkg1/FuncInf.html",
"<dl>\n" +
"<dt>Functional Interface:</dt>\n" +
"<dd>This is a functional interface and can therefore be used as " +
"the assignment target for a lambda expression or method " +
"reference.</dd>\n" +
"</dl>"}
};
private static final String[][] NEGATED_TEST = {
{ "pkg/A.html",
"<td class=\"colFirst\"><code>default default void</code></td>"},
{ "pkg/A.html",
"<pre>default&nbsp;default&nbsp;void&nbsp;defaultMethod()</pre>"},
{ "pkg/B.html",
"<td class=\"colFirst\"><code>default void</code></td>"},
{ "pkg1/NotAFuncInf.html",
"<dl>\n" +
"<dt>Functional Interface:</dt>\n" +
"<dd>This is a functional interface and can therefore be used as " +
"the assignment target for a lambda expression or method " +
"reference.</dd>\n" +
"</dl>"},
{ "pkg/B.html",
"<dl>\n" +
"<dt>Functional Interface:</dt>"}
};
private static final String[][] NEGATED_TEST_1 = {
{ "pkg1/FuncInf.html",
"<dl>\n" +
"<dt>Functional Interface:</dt>"}
};
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
public static void main(String... args) throws Exception {
TestLambdaFeature tester = new TestLambdaFeature();
tester.run(ARGS, TEST, NEGATED_TEST);
tester.run(ARGS_1, NO_TEST, NEGATED_TEST_1);
tester.printSummary();
tester.runTests();
}
@Test
void testDefault() {
javadoc("-d", "out-default",
"-sourcepath", testSrc,
"pkg", "pkg1");
checkExit(Exit.OK);
checkOutput("pkg/A.html", true,
"<td class=\"colFirst\"><code>default void</code></td>",
"<pre>default&nbsp;void&nbsp;defaultMethod()</pre>",
"<caption><span id=\"t0\" class=\"activeTableTab\"><span>"
+ "All Methods</span><span class=\"tabEnd\">&nbsp;</span></span>"
+ "<span id=\"t2\" class=\"tableTab\"><span>"
+ "<a href=\"javascript:show(2);\">Instance Methods</a></span>"
+ "<span class=\"tabEnd\">&nbsp;</span></span><span id=\"t3\" "
+ "class=\"tableTab\"><span><a href=\"javascript:show(4);\">"
+ "Abstract Methods</a></span><span class=\"tabEnd\">&nbsp;</span>"
+ "</span><span id=\"t5\" class=\"tableTab\"><span>"
+ "<a href=\"javascript:show(16);\">Default Methods</a></span>"
+ "<span class=\"tabEnd\">&nbsp;</span></span></caption>",
"<dl>\n"
+ "<dt>Functional Interface:</dt>\n"
+ "<dd>This is a functional interface and can therefore be used as "
+ "the assignment target for a lambda expression or method "
+ "reference.</dd>\n"
+ "</dl>");
checkOutput("pkg1/FuncInf.html", true,
"<dl>\n"
+ "<dt>Functional Interface:</dt>\n"
+ "<dd>This is a functional interface and can therefore be used as "
+ "the assignment target for a lambda expression or method "
+ "reference.</dd>\n"
+ "</dl>");
checkOutput("pkg/A.html", false,
"<td class=\"colFirst\"><code>default default void</code></td>",
"<pre>default&nbsp;default&nbsp;void&nbsp;defaultMethod()</pre>");
checkOutput("pkg/B.html", false,
"<td class=\"colFirst\"><code>default void</code></td>",
"<dl>\n"
+ "<dt>Functional Interface:</dt>");
checkOutput("pkg1/NotAFuncInf.html", false,
"<dl>\n"
+ "<dt>Functional Interface:</dt>\n"
+ "<dd>This is a functional interface and can therefore be used as "
+ "the assignment target for a lambda expression or method "
+ "reference.</dd>\n"
+ "</dl>");
}
@Test
void testSource7() {
javadoc("-d", "out-7",
"-sourcepath", testSrc,
"-source", "1.7",
"pkg1");
checkExit(Exit.OK);
checkOutput("pkg1/FuncInf.html", false,
"<dl>\n"
+ "<dt>Functional Interface:</dt>");
}
}

View file

@ -29,37 +29,35 @@
* begin their comment without a leading star without leading
* spaces stripped
* @author jamieh
* @library ../lib/
* @library ../lib
* @build JavadocTester
* @build LeadingSpaces
* @run main LeadingSpaces
*/
public class LeadingSpaces extends JavadocTester {
private static final String[][] TEST = {
{ "LeadingSpaces.html",
" 1\n" +
" 2\n" +
" 3\n" +
" 4\n" +
" 5\n" +
" 6\n" +
" 7"}
};
private static final String[] ARGS =
new String[] {
"-d", OUTPUT_DIR, "-sourcepath", SRC_DIR,
SRC_DIR + "/LeadingSpaces.java"};
/**
* The entry point of the test.
* @param args the array of command line arguments.
* @throws Exception if the test fails
*/
public static void main(String[] args) {
public static void main(String... args) throws Exception {
LeadingSpaces tester = new LeadingSpaces();
tester.run(ARGS, TEST, NO_TEST);
tester.printSummary();
tester.runTests();
}
@Test
void testLeadingSpaces() {
javadoc("-d", "out", "-sourcepath", testSrc,
testSrc("LeadingSpaces.java"));
checkExit(Exit.OK);
checkOutput("LeadingSpaces.html", true,
" 1\n"
+ " 2\n"
+ " 3\n"
+ " 4\n"
+ " 5\n"
+ " 6\n"
+ " 7");
}
/**

View file

@ -27,38 +27,35 @@
* @summary Test to ensure that the refactored version of the standard
* doclet still works with Taglets that implement the 1.4.0 interface.
* @author jamieh
* @library ../lib/
* @compile ../lib/JavadocTester.java TestLegacyTaglet.java ToDoTaglet.java UnderlineTaglet.java Check.java
* @library ../lib
* @build JavadocTester ToDoTaglet UnderlineTaglet Check
* @run main TestLegacyTaglet
*/
public class TestLegacyTaglet extends JavadocTester {
private static final String[] ARGS =
new String[] {"-d", OUTPUT_DIR, "-sourcepath", SRC_DIR,
"-tagletpath", SRC_DIR, "-taglet", "ToDoTaglet", "-taglet", "Check",
"-taglet", "UnderlineTaglet", SRC_DIR + "/C.java"};
private static final String[][] TEST = new String[][] {
{ "C.html", "This is an <u>underline</u>"},
{ "C.html",
"<DT><B>To Do:</B><DD><table cellpadding=2 cellspacing=0><tr>" +
"<td bgcolor=\"yellow\">Finish this class.</td></tr></table></DD>"},
{ "C.html",
"<DT><B>To Do:</B><DD><table cellpadding=2 cellspacing=0><tr>" +
"<td bgcolor=\"yellow\">Tag in Method.</td></tr></table></DD>"}
};
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
public static void main(String... args) throws Exception {
TestLegacyTaglet tester = new TestLegacyTaglet();
tester.run(ARGS, TEST, NO_TEST);
if (tester.getErrorOutput().contains("NullPointerException")) {
throw new AssertionError("javadoc threw NullPointerException");
tester.runTests();
}
tester.printSummary();
@Test
void test() {
javadoc("-d", "out",
"-sourcepath", testSrc,
"-tagletpath", testSrc,
"-taglet", "ToDoTaglet",
"-taglet", "Check",
"-taglet", "UnderlineTaglet",
testSrc("C.java"));
checkExit(Exit.OK);
checkOutput("C.html", true,
"This is an <u>underline</u>",
"<DT><B>To Do:</B><DD><table cellpadding=2 cellspacing=0><tr>" +
"<td bgcolor=\"yellow\">Finish this class.</td></tr></table></DD>",
"<DT><B>To Do:</B><DD><table cellpadding=2 cellspacing=0><tr>" +
"<td bgcolor=\"yellow\">Tag in Method.</td></tr></table></DD>");
checkOutput(Output.STDERR, false,
"NullPointerException");
}
}

View file

@ -26,34 +26,32 @@
* @bug 4625883
* @summary Make sure that bad -link arguments trigger warnings.
* @author jamieh
* @library ../lib/
* @library ../lib
* @build JavadocTester
* @build TestBadLinkOption
* @run main TestBadLinkOption
*/
public class TestBadLinkOption extends JavadocTester {
private static final String[] ARGS = new String[] {
"-d", OUTPUT_DIR, "-sourcepath", SRC_DIR,
"-link", OUTPUT_DIR, "pkg"
};
private static final String[][] TEST = {
{WARNING_OUTPUT, "Error reading file:"}
};
private static final String[][] NEG_TEST = {
{ERROR_OUTPUT, "Error reading file:"}
};
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
public static void main(String... args) throws Exception {
TestBadLinkOption tester = new TestBadLinkOption();
tester.run(ARGS, TEST, NEG_TEST);
tester.printSummary();
tester.runTests();
}
@Test
void test() {
String out = "out";
javadoc("-d", out,
"-sourcepath", testSrc,
"-link", out,
"pkg");
checkExit(Exit.OK);
// TODO: the file it is trying to read, out/out/package-list, warrants investigation
checkOutput(Output.WARNING, true,
"Error reading file:");
checkOutput(Output.ERROR, false,
"Error reading file:");
}
}

View file

@ -27,105 +27,111 @@
* @summary Test to make sure that -link and -linkoffline link to
* right files, and URLs with and without trailing slash are accepted.
* @author jamieh
* @library ../lib/
* @build JavadocTester TestLinkOption
* @library ../lib
* @build JavadocTester
* @run main TestLinkOption
*/
import java.io.File;
public class TestLinkOption extends JavadocTester {
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String... args) throws Exception {
TestLinkOption tester = new TestLinkOption();
tester.runTests();
}
// The following test runs javadoc multiple times; it is important that the
// first one is run first, since the subsequent runs refer to the output
// it generates. Therefore we run everything serially in a single @Test
// method and not in independent @Test methods.
@Test
void test() {
// Generate the documentation using -linkoffline and a URL as the first parameter.
private static final String[] ARGS1 = new String[] {
"-d", OUTPUT_DIR + "-1", "-sourcepath", SRC_DIR,
"-linkoffline", "http://java.sun.com/j2se/1.4/docs/api/",
SRC_DIR, "-package", "pkg", "java.lang"
};
String out1 = "out1";
String url = "http://java.sun.com/j2se/1.4/docs/api/";
javadoc("-d", out1,
"-sourcepath", testSrc,
"-linkoffline", url, testSrc,
"-package",
"pkg", "java.lang");
checkExit(Exit.OK);
private static final String[][] TEST1 = {
{ "pkg/C.html",
"<a href=\"http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html?is-external=true\" " +
"title=\"class or interface in java.lang\"><code>Link to String Class</code></a>"
},
checkOutput("pkg/C.html", true,
"<a href=\"" + url + "java/lang/String.html?is-external=true\" "
+ "title=\"class or interface in java.lang\"><code>Link to String Class</code></a>",
//Make sure the parameters are indented properly when the -link option is used.
{ "pkg/C.html",
"(int&nbsp;p1,\n" +
" int&nbsp;p2,\n" +
" int&nbsp;p3)"
},
{ "pkg/C.html",
"(int&nbsp;p1,\n" +
" int&nbsp;p2,\n" +
" <a href=\"http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html?is-external=true\" title=\"class or interface in java.lang\">" +
"Object</a>&nbsp;p3)"
},
{ "java/lang/StringBuilderChild.html",
"<pre>public abstract class <span class=\"typeNameLabel\">StringBuilderChild</span>\n" +
"extends <a href=\"http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html?is-external=true\" " +
"title=\"class or interface in java.lang\">Object</a></pre>"
},
"(int&nbsp;p1,\n"
+ " int&nbsp;p2,\n"
+ " int&nbsp;p3)",
"(int&nbsp;p1,\n"
+ " int&nbsp;p2,\n"
+ " <a href=\"" + url + "java/lang/Object.html?is-external=true\" title=\"class or interface in java.lang\">"
+ "Object</a>&nbsp;p3)");
};
private static final String[][] NEGATED_TEST1 = NO_TEST;
checkOutput("java/lang/StringBuilderChild.html", true,
"<pre>public abstract class <span class=\"typeNameLabel\">StringBuilderChild</span>\n"
+ "extends <a href=\"" + url + "java/lang/Object.html?is-external=true\" "
+ "title=\"class or interface in java.lang\">Object</a></pre>"
);
// Generate the documentation using -linkoffline and a relative path as the first parameter.
// We will try linking to the docs generated in test 1 with a relative path.
private static final String[] ARGS2 = new String[] {
"-d", OUTPUT_DIR + "-2", "-sourcepath", SRC_DIR,
"-linkoffline", "../" + OUTPUT_DIR + "-1",
OUTPUT_DIR + "-1", "-package", "pkg2"
};
private static final String[][] TEST2 = {
{ "pkg2/C2.html",
"This is a link to <a href=\"../../" +
OUTPUT_DIR + "-1/pkg/C.html?is-external=true\" " +
String out2 = "out2";
javadoc("-d", out2,
"-sourcepath", testSrc,
"-linkoffline", "../" + out1, out1,
"-package",
"pkg2");
checkExit(Exit.OK);
checkOutput("pkg2/C2.html", true,
"This is a link to <a href=\"../../" + out1 + "/pkg/C.html?is-external=true\" " +
"title=\"class or interface in pkg\"><code>Class C</code></a>."
);
String out3 = "out3";
javadoc(createArguments(out3, out1, true)); // with trailing slash
checkExit(Exit.OK);
String out4 = "out4";
javadoc(createArguments(out4, out1, false)); // without trailing slash
checkExit(Exit.OK);
// Note: the following test is very weak, and will fail if ever the test
// of the message is changed. We should have a separate test to verify
// this is the text that is given when there is a problem with a URL
checkOutput(Output.WARNING, false,
"warning - Error fetching URL");
}
};
/*
* Create the documentation using the -link option, vary the behavior with
* both trailing and no trailing slash. We are only interested in ensuring
* that the command executes with no errors or related warnings.
*/
static String[] createArguments(boolean withTrailingSlash) {
String packagePath = new File(OUTPUT_DIR + "-1").getAbsolutePath();
String outputDirName = OUTPUT_DIR;
static String[] createArguments(String outDir, String packageDir, boolean withTrailingSlash) {
String packagePath = new File(packageDir).getAbsolutePath();
if (withTrailingSlash) {
// add the trailing slash, if it is not present!
if (!packagePath.endsWith(FS)) {
packagePath = packagePath + FS;
}
outputDirName = outputDirName + "-3";
} else {
// remove the trailing slash, if it is present!
if (packagePath.endsWith(FS)) {
packagePath = packagePath.substring(0, packagePath.length() - 1);
}
outputDirName = outputDirName + "-4";
}
String args[] = {
"-d", outputDirName, "-sourcepath", SRC_DIR,
"-link", "file:///" + packagePath, "-package", "pkg2"
"-d", outDir,
"-sourcepath", testSrc,
"-link", "file:///" + packagePath,
"-package",
"pkg2"
};
System.out.println("packagePath: " + packagePath);
return args;
}
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
TestLinkOption tester = new TestLinkOption();
tester.run(ARGS1, TEST1, NEGATED_TEST1);
tester.run(ARGS2, TEST2, NO_TEST);
tester.runJavadoc(createArguments(true)); // with trailing slash
tester.runJavadoc(createArguments(false)); // without trailing slash
tester.printSummary();
if (tester.getWarningOutput().contains("warning - Error fetching URL")) {
throw new Error("URL rejected ?");
}
tester.printSummary();
}
}

View file

@ -27,32 +27,27 @@
* @summary Make sure that a new line may act as a separator between
* link and label.
* @author jamieh
* @library ../lib/
* @library ../lib
* @build JavadocTester
* @build TestNewLineInLink
* @run main TestNewLineInLink
*/
public class TestNewLineInLink extends JavadocTester {
private static final String[][] NEGATED_TEST =
new String[][] {
{ERROR_OUTPUT,
"illegal character"}
};
private static final String[] ARGS = new String[] {
"-d", OUTPUT_DIR, "-sourcepath", SRC_DIR,
"-linkoffline", "http://www.java.sun.com/j2se/1.4/docs/api",
SRC_DIR, "testNewLineInLink"};
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
public static void main(String... args) throws Exception {
TestNewLineInLink tester = new TestNewLineInLink();
tester.run(ARGS, new String[][] {}, NEGATED_TEST);
tester.printSummary();
tester.runTests();
}
@Test
void test() {
javadoc("-d", "out",
"-sourcepath", testSrc,
"-linkoffline", "http://www.java.sun.com/j2se/1.4/docs/api", testSrc,
"testNewLineInLink");
checkExit(Exit.OK);
checkOutput(Output.ERROR, false,
"illegal character");
}
}

View file

@ -27,53 +27,46 @@
* @summary Make sure that you can link from one member to another using
* non-qualified name, furthermore, ensure the right one is linked.
* @author jamieh
* @library ../lib/
* @library ../lib
* @build JavadocTester
* @build TestLinkTaglet
* @run main TestLinkTaglet
*/
public class TestLinkTaglet extends JavadocTester {
//Javadoc arguments.
private static final String[] ARGS = new String[] {
"-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg", SRC_DIR +
"/checkPkg/B.java"
};
//Input for string search tests.
private static final String[][] TEST = {
{ "pkg/C.html",
"Qualified Link: <a href=\"../pkg/C.InnerC.html\" title=\"class in pkg\"><code>C.InnerC</code></a>.<br/>\n" +
" Unqualified Link1: <a href=\"../pkg/C.InnerC.html\" title=\"class in pkg\"><code>C.InnerC</code></a>.<br/>\n" +
" Unqualified Link2: <a href=\"../pkg/C.InnerC.html\" title=\"class in pkg\"><code>C.InnerC</code></a>.<br/>\n" +
" Qualified Link: <a href=\"../pkg/C.html#method-pkg.C.InnerC-pkg.C.InnerC2-\"><code>method(pkg.C.InnerC, pkg.C.InnerC2)</code></a>.<br/>\n" +
" Unqualified Link: <a href=\"../pkg/C.html#method-pkg.C.InnerC-pkg.C.InnerC2-\"><code>method(C.InnerC, C.InnerC2)</code></a>.<br/>\n" +
" Unqualified Link: <a href=\"../pkg/C.html#method-pkg.C.InnerC-pkg.C.InnerC2-\"><code>method(InnerC, InnerC2)</code></a>.<br/>"
},
{ "pkg/C.InnerC.html",
"Link to member in outer class: <a href=\"../pkg/C.html#MEMBER\"><code>C.MEMBER</code></a> <br/>\n" +
" Link to member in inner class: <a href=\"../pkg/C.InnerC2.html#MEMBER2\"><code>C.InnerC2.MEMBER2</code></a> <br/>\n" +
" Link to another inner class: <a href=\"../pkg/C.InnerC2.html\" title=\"class in pkg\"><code>C.InnerC2</code></a>"
},
{ "pkg/C.InnerC2.html",
"<dl>\n" +
"<dt>Enclosing class:</dt>\n" +
"<dd><a href=\"../pkg/C.html\" title=\"class in pkg\">C</a></dd>\n" +
"</dl>"
},
};
private static final String[][] NEGATED_TEST = {
{WARNING_OUTPUT, "Tag @see: reference not found: A"},
};
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
public static void main(String... args) throws Exception {
TestLinkTaglet tester = new TestLinkTaglet();
tester.run(ARGS, TEST, NEGATED_TEST);
tester.printSummary();
tester.runTests();
}
@Test
void test() {
javadoc("-Xdoclint:none",
"-d", "out",
"-sourcepath", testSrc,
"pkg", testSrc("checkPkg/B.java"));
checkExit(Exit.OK);
checkOutput("pkg/C.html", true,
"Qualified Link: <a href=\"../pkg/C.InnerC.html\" title=\"class in pkg\"><code>C.InnerC</code></a>.<br/>\n"
+ " Unqualified Link1: <a href=\"../pkg/C.InnerC.html\" title=\"class in pkg\"><code>C.InnerC</code></a>.<br/>\n"
+ " Unqualified Link2: <a href=\"../pkg/C.InnerC.html\" title=\"class in pkg\"><code>C.InnerC</code></a>.<br/>\n"
+ " Qualified Link: <a href=\"../pkg/C.html#method-pkg.C.InnerC-pkg.C.InnerC2-\"><code>method(pkg.C.InnerC, pkg.C.InnerC2)</code></a>.<br/>\n"
+ " Unqualified Link: <a href=\"../pkg/C.html#method-pkg.C.InnerC-pkg.C.InnerC2-\"><code>method(C.InnerC, C.InnerC2)</code></a>.<br/>\n"
+ " Unqualified Link: <a href=\"../pkg/C.html#method-pkg.C.InnerC-pkg.C.InnerC2-\"><code>method(InnerC, InnerC2)</code></a>.<br/>");
checkOutput("pkg/C.InnerC.html", true,
"Link to member in outer class: <a href=\"../pkg/C.html#MEMBER\"><code>C.MEMBER</code></a> <br/>\n"
+ " Link to member in inner class: <a href=\"../pkg/C.InnerC2.html#MEMBER2\"><code>C.InnerC2.MEMBER2</code></a> <br/>\n"
+ " Link to another inner class: <a href=\"../pkg/C.InnerC2.html\" title=\"class in pkg\"><code>C.InnerC2</code></a>");
checkOutput("pkg/C.InnerC2.html", true,
"<dl>\n"
+ "<dt>Enclosing class:</dt>\n"
+ "<dd><a href=\"../pkg/C.html\" title=\"class in pkg\">C</a></dd>\n"
+ "</dl>");
checkOutput(Output.WARNING, false,
"Tag @see: reference not found: A");
}
}

View file

@ -27,29 +27,28 @@
* @summary Test to make sure that there is a link with a proper anchor
* from a serializable class to serialized-form.html.
* @author jamieh
* @library ../lib/
* @library ../lib
* @build JavadocTester
* @build TestLinkToSerialForm
* @run main TestLinkToSerialForm
*/
public class TestLinkToSerialForm extends JavadocTester {
private static final String[][] TEST = {
{ "serialized-form.html", "<a name=\"pkg.C\">"},
{ "pkg/C.html", "<a href=\"../serialized-form.html#pkg.C\">"}
};
private static final String[] ARGS =
new String[] {
"-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg"};
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
public static void main(String... args) throws Exception {
TestLinkToSerialForm tester = new TestLinkToSerialForm();
tester.run(ARGS, TEST, NO_TEST);
tester.printSummary();
tester.runTests();
}
@Test
void test() {
javadoc("-d", "out",
"-sourcepath", testSrc,
"pkg");
checkExit(Exit.OK);
checkOutput("serialized-form.html", true,
"<a name=\"pkg.C\">");
checkOutput("pkg/C.html", true,
"<a href=\"../serialized-form.html#pkg.C\">");
}
}

View file

@ -25,73 +25,61 @@
* @test
* @bug 8002387 8014636
* @summary Improve rendered HTML formatting for {@code}
* @library ../lib/
* @build JavadocTester TestLiteralCodeInPre
* @library ../lib
* @build JavadocTester
* @run main TestLiteralCodeInPre
*/
public class TestLiteralCodeInPre extends JavadocTester {
//Javadoc arguments.
private static final String[] ARGS = new String[] {
"-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "-Xdoclint:none", "pkg"
};
//Input for string search tests.
private static final String[][] TEST = {
{ "pkg/Test.html",
"no_pre()</pre>\n" +
"<div class=\"block\">abc<code>def</code>ghi</div>" },
{ "pkg/Test.html",
"no_pre_extra_whitespace()</pre>\n" +
"<div class=\"block\">abc<code>def </code>ghi</div>" },
{ "pkg/Test.html",
"in_pre()</pre>\n" +
"<div class=\"block\"><pre> abc<code> def </code>ghi</pre></div>" },
{ "pkg/Test.html",
"pre_after_text()</pre>\n" +
"<div class=\"block\">xyz <pre> abc<code> def </code>ghi</pre></div>" },
{ "pkg/Test.html",
"after_pre()</pre>\n" +
"<div class=\"block\">xyz <pre> pqr </pre> abc<code>def </code>ghi</div>" },
{ "pkg/Test.html",
"back_in_pre()</pre>\n" +
"<div class=\"block\">xyz <pre> pqr </pre> mno <pre> abc<code> def </code>ghi</pre></div>" },
{ "pkg/Test.html",
"typical_usage_code()</pre>\n" +
"<div class=\"block\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.\n" +
" Example: <pre><code>\n" +
" line 1 &lt;T&gt; void m(T t) {\n" +
" line 2 // do something with T\n" +
" line 3 }\n" +
" </code></pre>\n" +
" and so it goes.</div>" },
{ "pkg/Test.html",
"typical_usage_literal()</pre>\n" +
"<div class=\"block\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.\n" +
" Example: <pre>\n" +
" line 1 &lt;T&gt; void m(T t) {\n" +
" line 2 // do something with T\n" +
" line 3 }\n" +
" </pre>\n" +
" and so it goes.</div>" },
{ "pkg/Test.html",
"recommended_usage_literal()</pre>\n" +
"<div class=\"block\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.\n" +
" Example: <pre>\n" +
" line 1 &lt;T&gt; void m(T t) {\n" +
" line 2 // do something with T\n" +
" line 3 } </pre>\n" +
" and so it goes.</div>" }
};
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
public static void main(String... args) throws Exception {
TestLiteralCodeInPre tester = new TestLiteralCodeInPre();
tester.run(ARGS, TEST, NO_TEST);
tester.printSummary();
tester.runTests();
}
@Test
void test() {
javadoc("-d", "out",
"-sourcepath", testSrc,
"-Xdoclint:none",
"pkg");
checkExit(Exit.OK);
checkOutput("pkg/Test.html", true,
"no_pre()</pre>\n"
+ "<div class=\"block\">abc<code>def</code>ghi</div>",
"no_pre_extra_whitespace()</pre>\n"
+ "<div class=\"block\">abc<code>def </code>ghi</div>",
"in_pre()</pre>\n"
+ "<div class=\"block\"><pre> abc<code> def </code>ghi</pre></div>",
"pre_after_text()</pre>\n"
+ "<div class=\"block\">xyz <pre> abc<code> def </code>ghi</pre></div>",
"after_pre()</pre>\n"
+ "<div class=\"block\">xyz <pre> pqr </pre> abc<code>def </code>ghi</div>",
"back_in_pre()</pre>\n"
+ "<div class=\"block\">xyz <pre> pqr </pre> mno <pre> abc<code> def </code>ghi</pre></div>",
"typical_usage_code()</pre>\n"
+ "<div class=\"block\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.\n"
+ " Example: <pre><code>\n"
+ " line 1 &lt;T&gt; void m(T t) {\n"
+ " line 2 // do something with T\n"
+ " line 3 }\n"
+ " </code></pre>\n"
+ " and so it goes.</div>",
"typical_usage_literal()</pre>\n"
+ "<div class=\"block\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.\n"
+ " Example: <pre>\n"
+ " line 1 &lt;T&gt; void m(T t) {\n"
+ " line 2 // do something with T\n"
+ " line 3 }\n"
+ " </pre>\n"
+ " and so it goes.</div>",
"recommended_usage_literal()</pre>\n"
+ "<div class=\"block\">Lorem ipsum dolor sit amet, consectetur adipiscing elit.\n"
+ " Example: <pre>\n"
+ " line 1 &lt;T&gt; void m(T t) {\n"
+ " line 2 // do something with T\n"
+ " line 3 } </pre>\n"
+ " and so it goes.</div>");
}
}

View file

@ -27,83 +27,63 @@
* @summary Test to make sure that members are inherited properly in the Javadoc.
* Verify that inheritence labels are correct.
* @author jamieh
* @library ../lib/
* @library ../lib
* @build JavadocTester
* @build TestMemberInheritence
* @run main TestMemberInheritence
*/
public class TestMemberInheritence extends JavadocTester {
private static final String[][] TEST = {
//Public field should be inherited
{ "pkg/SubClass.html",
"<a href=\"../pkg/BaseClass.html#pubField\">"},
//Public method should be inherited
{ "pkg/SubClass.html",
"<a href=\"../pkg/BaseClass.html#pubMethod--\">"},
//Public inner class should be inherited.
{ "pkg/SubClass.html",
"<a href=\"../pkg/BaseClass.pubInnerClass.html\" title=\"class in pkg\">"},
//Protected field should be inherited
{ "pkg/SubClass.html",
"<a href=\"../pkg/BaseClass.html#proField\">"},
//Protected method should be inherited
{ "pkg/SubClass.html",
"<a href=\"../pkg/BaseClass.html#proMethod--\">"},
//Protected inner class should be inherited.
{ "pkg/SubClass.html",
"<a href=\"../pkg/BaseClass.proInnerClass.html\" title=\"class in pkg\">"},
// New labels as of 1.5.0
{ "pkg/SubClass.html",
"Nested classes/interfaces inherited from class&nbsp;pkg." +
"<a href=\"../pkg/BaseClass.html\" title=\"class in pkg\">BaseClass</a>"},
{ "pkg/SubClass.html",
"Nested classes/interfaces inherited from interface&nbsp;pkg." +
"<a href=\"../pkg/BaseInterface.html\" title=\"interface in pkg\">BaseInterface</a>"},
// Test overriding/implementing methods with generic parameters.
{ "pkg/BaseClass.html",
"<dl>\n" +
"<dt><span class=\"overrideSpecifyLabel\">Specified by:</span></dt>\n" +
"<dd><code><a href=\"../pkg/BaseInterface.html#getAnnotation-java.lang.Class-\">" +
"getAnnotation</a></code>&nbsp;in interface&nbsp;<code>" +
"<a href=\"../pkg/BaseInterface.html\" title=\"interface in pkg\">" +
"BaseInterface</a></code></dd>\n" +
"</dl>"},
// Test diamond inheritence member summary (6256068)
{ "diamond/Z.html",
"<code><a href=\"../diamond/A.html#aMethod--\">aMethod</a></code>"},
// Test that doc is inherited from closed parent (6270645)
{ "inheritDist/C.html",
"<div class=\"block\">m1-B</div>"},
};
private static final String[][] NEGATED_TEST = {
{ "pkg/SubClass.html",
"<a href=\"../pkg/BaseClass.html#staticMethod--\">staticMethod</a></code>"},
};
private static final String[] ARGS =
new String[] {
"-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg", "diamond",
"inheritDist"};
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
public static void main(String... args) throws Exception {
TestMemberInheritence tester = new TestMemberInheritence();
tester.run(ARGS, TEST, NEGATED_TEST);
tester.printSummary();
tester.runTests();
}
@Test
void test() {
javadoc("-d", "out",
"-sourcepath", testSrc,
"pkg", "diamond", "inheritDist");
checkExit(Exit.OK);
checkOutput("pkg/SubClass.html", true,
// Public field should be inherited
"<a href=\"../pkg/BaseClass.html#pubField\">",
// Public method should be inherited
"<a href=\"../pkg/BaseClass.html#pubMethod--\">",
// Public inner class should be inherited.
"<a href=\"../pkg/BaseClass.pubInnerClass.html\" title=\"class in pkg\">",
// Protected field should be inherited
"<a href=\"../pkg/BaseClass.html#proField\">",
// Protected method should be inherited
"<a href=\"../pkg/BaseClass.html#proMethod--\">",
// Protected inner class should be inherited.
"<a href=\"../pkg/BaseClass.proInnerClass.html\" title=\"class in pkg\">",
// New labels as of 1.5.0
"Nested classes/interfaces inherited from class&nbsp;pkg."
+ "<a href=\"../pkg/BaseClass.html\" title=\"class in pkg\">BaseClass</a>",
"Nested classes/interfaces inherited from interface&nbsp;pkg."
+ "<a href=\"../pkg/BaseInterface.html\" title=\"interface in pkg\">BaseInterface</a>");
checkOutput("pkg/BaseClass.html", true,
// Test overriding/implementing methods with generic parameters.
"<dl>\n"
+ "<dt><span class=\"overrideSpecifyLabel\">Specified by:</span></dt>\n"
+ "<dd><code><a href=\"../pkg/BaseInterface.html#getAnnotation-java.lang.Class-\">"
+ "getAnnotation</a></code>&nbsp;in interface&nbsp;<code>"
+ "<a href=\"../pkg/BaseInterface.html\" title=\"interface in pkg\">"
+ "BaseInterface</a></code></dd>\n"
+ "</dl>");
checkOutput("diamond/Z.html", true,
// Test diamond inheritence member summary (6256068)
"<code><a href=\"../diamond/A.html#aMethod--\">aMethod</a></code>");
checkOutput("inheritDist/C.html", true,
// Test that doc is inherited from closed parent (6270645)
"<div class=\"block\">m1-B</div>");
checkOutput("pkg/SubClass.html", false,
"<a href=\"../pkg/BaseClass.html#staticMethod--\">staticMethod</a></code>");
}
}

View file

@ -28,50 +28,40 @@
* type than the method in the child class. Make sure the
* documentation is inherited but the return type isn't.
* @author jamieh
* @library ../lib/
* @library ../lib
* @build JavadocTester
* @build TestMemberSummary
* @run main TestMemberSummary
*/
public class TestMemberSummary extends JavadocTester {
//Javadoc arguments.
private static final String[] ARGS = new String[] {
"-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg","pkg2"
};
public static void main(String... args) throws Exception {
TestMemberSummary tester = new TestMemberSummary();
tester.runTests();
}
//Input for string search tests.
private static final String[][] TEST = {
@Test
void test() {
javadoc("-d", "out",
"-sourcepath", testSrc,
"pkg","pkg2");
checkExit(Exit.OK);
checkOutput("pkg/PublicChild.html", true,
// Check return type in member summary.
{ "pkg/PublicChild.html",
"<code><a href=\"../pkg/PublicChild.html\" title=\"class in pkg\">PublicChild</a></code></td>\n" +
"<td class=\"colLast\"><code><span class=\"memberNameLink\"><a href=\"../pkg/PublicChild.html#returnTypeTest--\">" +
"returnTypeTest</a></span>()</code>"
},
"<code><a href=\"../pkg/PublicChild.html\" title=\"class in pkg\">PublicChild</a></code></td>\n"
+ "<td class=\"colLast\"><code><span class=\"memberNameLink\"><a href=\"../pkg/PublicChild.html#returnTypeTest--\">"
+ "returnTypeTest</a></span>()</code>",
// Check return type in member detail.
{ "pkg/PublicChild.html",
"<pre>public&nbsp;<a href=\"../pkg/PublicChild.html\" title=\"class in pkg\">" +
"PublicChild</a>&nbsp;returnTypeTest()</pre>"
},
"<pre>public&nbsp;<a href=\"../pkg/PublicChild.html\" title=\"class in pkg\">"
+ "PublicChild</a>&nbsp;returnTypeTest()</pre>");
// Legacy anchor dimensions (6290760)
{ "pkg2/A.html",
"<a name=\"f-java.lang.Object:A-\">\n" +
"<!-- -->\n" +
"</a><a name=\"f-T:A-\">\n" +
"<!-- -->\n" +
"</a>"
},
};
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
TestMemberSummary tester = new TestMemberSummary();
tester.run(ARGS, TEST, NO_TEST);
tester.printSummary();
checkOutput("pkg2/A.html", true,
"<a name=\"f-java.lang.Object:A-\">\n"
+ "<!-- -->\n"
+ "</a><a name=\"f-T:A-\">\n"
+ "<!-- -->\n"
+ "</a>");
}
}

View file

@ -26,97 +26,74 @@
* @bug 8002304 8024096
* @summary Test for various method types in the method summary table
* @author Bhavesh Patel
* @library ../lib/
* @build JavadocTester TestMethodTypes
* @library ../lib
* @build JavadocTester
* @run main TestMethodTypes
*/
public class TestMethodTypes extends JavadocTester {
//Javadoc arguments.
private static final String[] ARGS = new String[] {
"-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg1"
};
private static final String[][] TEST = {
{ "pkg1/A.html",
"var methods = {"
},
{ "pkg1/A.html",
"<caption><span id=\"t0\" class=\"activeTableTab\"><span>All " +
"Methods</span><span class=\"tabEnd\">&nbsp;</span></span>" +
"<span id=\"t1\" class=\"tableTab\"><span><a href=\"javascript:show(1);\">" +
"Static Methods</a></span><span class=\"tabEnd\">&nbsp;</span></span>" +
"<span id=\"t2\" class=\"tableTab\"><span><a href=\"javascript:show(2);\">" +
"Instance Methods</a></span><span class=\"tabEnd\">&nbsp;</span></span>" +
"<span id=\"t4\" class=\"tableTab\"><span><a href=\"javascript:show(8);\">" +
"Concrete Methods</a></span><span class=\"tabEnd\">&nbsp;</span></span>" +
"<span id=\"t6\" class=\"tableTab\"><span><a href=\"javascript:show(32);\">" +
"Deprecated Methods</a></span><span class=\"tabEnd\">&nbsp;</span></span>" +
"</caption>"
},
{ "pkg1/A.html",
"<tr id=\"i0\" class=\"altColor\">"
},
{ "pkg1/B.html",
"<caption><span id=\"t0\" class=\"activeTableTab\"><span>All " +
"Methods</span><span class=\"tabEnd\">&nbsp;</span></span>" +
"<span id=\"t2\" class=\"tableTab\"><span><a href=\"javascript:show(2);\">" +
"Instance Methods</a></span><span class=\"tabEnd\">&nbsp;</span></span>" +
"<span id=\"t3\" class=\"tableTab\"><span><a href=\"javascript:show(4);\">" +
"Abstract Methods</a></span><span class=\"tabEnd\">&nbsp;</span></span>" +
"</caption>"
},
{ "pkg1/D.html",
"var methods = {"
},
{ "pkg1/D.html",
"<caption><span id=\"t0\" class=\"activeTableTab\"><span>All " +
"Methods</span><span class=\"tabEnd\">&nbsp;</span></span>" +
"<span id=\"t2\" class=\"tableTab\"><span><a href=\"javascript:show(2);\">" +
"Instance Methods</a></span><span class=\"tabEnd\">&nbsp;</span></span>" +
"<span id=\"t3\" class=\"tableTab\"><span><a href=\"javascript:show(4);\">" +
"Abstract Methods</a></span><span class=\"tabEnd\">&nbsp;</span></span>" +
"<span id=\"t4\" class=\"tableTab\"><span><a href=\"javascript:show(8);\">" +
"Concrete Methods</a></span><span class=\"tabEnd\">&nbsp;</span></span>" +
"<span id=\"t6\" class=\"tableTab\"><span><a href=\"javascript:show(32);\">" +
"Deprecated Methods</a></span><span class=\"tabEnd\">&nbsp;</span></span>" +
"</caption>"
},
{ "pkg1/D.html",
"<tr id=\"i0\" class=\"altColor\">"
},
};
private static final String[][] NEGATED_TEST = {
{ "pkg1/A.html",
"<caption><span>Methods</span><span class=\"tabEnd\">&nbsp;</span>" +
"</caption>"
},
{ "pkg1/B.html",
"<caption><span>Methods</span><span class=\"tabEnd\">&nbsp;</span>" +
"</caption>"
},
{ "pkg1/D.html",
"<caption><span>Methods</span><span class=\"tabEnd\">&nbsp;</span>" +
"</caption>"
},
};
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
public static void main(String... args) throws Exception {
TestMethodTypes tester = new TestMethodTypes();
tester.run(ARGS, TEST, NEGATED_TEST);
tester.printSummary();
tester.runTests();
}
@Test
void test() {
javadoc("-d", "out",
"-sourcepath", testSrc,
"pkg1");
checkExit(Exit.OK);
checkOutput("pkg1/A.html", true,
"var methods = {",
"<caption><span id=\"t0\" class=\"activeTableTab\"><span>All "
+ "Methods</span><span class=\"tabEnd\">&nbsp;</span></span>"
+ "<span id=\"t1\" class=\"tableTab\"><span><a href=\"javascript:show(1);\">"
+ "Static Methods</a></span><span class=\"tabEnd\">&nbsp;</span></span>"
+ "<span id=\"t2\" class=\"tableTab\"><span><a href=\"javascript:show(2);\">"
+ "Instance Methods</a></span><span class=\"tabEnd\">&nbsp;</span></span>"
+ "<span id=\"t4\" class=\"tableTab\"><span><a href=\"javascript:show(8);\">"
+ "Concrete Methods</a></span><span class=\"tabEnd\">&nbsp;</span></span>"
+ "<span id=\"t6\" class=\"tableTab\"><span><a href=\"javascript:show(32);\">"
+ "Deprecated Methods</a></span><span class=\"tabEnd\">&nbsp;</span></span>"
+ "</caption>",
"<tr id=\"i0\" class=\"altColor\">");
checkOutput("pkg1/B.html", true,
"<caption><span id=\"t0\" class=\"activeTableTab\"><span>All "
+ "Methods</span><span class=\"tabEnd\">&nbsp;</span></span>"
+ "<span id=\"t2\" class=\"tableTab\"><span><a href=\"javascript:show(2);\">"
+ "Instance Methods</a></span><span class=\"tabEnd\">&nbsp;</span></span>"
+ "<span id=\"t3\" class=\"tableTab\"><span><a href=\"javascript:show(4);\">"
+ "Abstract Methods</a></span><span class=\"tabEnd\">&nbsp;</span></span>"
+ "</caption>");
checkOutput("pkg1/D.html", true,
"var methods = {",
"<caption><span id=\"t0\" class=\"activeTableTab\"><span>All "
+ "Methods</span><span class=\"tabEnd\">&nbsp;</span></span>"
+ "<span id=\"t2\" class=\"tableTab\"><span><a href=\"javascript:show(2);\">"
+ "Instance Methods</a></span><span class=\"tabEnd\">&nbsp;</span></span>"
+ "<span id=\"t3\" class=\"tableTab\"><span><a href=\"javascript:show(4);\">"
+ "Abstract Methods</a></span><span class=\"tabEnd\">&nbsp;</span></span>"
+ "<span id=\"t4\" class=\"tableTab\"><span><a href=\"javascript:show(8);\">"
+ "Concrete Methods</a></span><span class=\"tabEnd\">&nbsp;</span></span>"
+ "<span id=\"t6\" class=\"tableTab\"><span><a href=\"javascript:show(32);\">"
+ "Deprecated Methods</a></span><span class=\"tabEnd\">&nbsp;</span></span>"
+ "</caption>",
"<tr id=\"i0\" class=\"altColor\">");
checkOutput("pkg1/A.html", false,
"<caption><span>Methods</span><span class=\"tabEnd\">&nbsp;</span>"
+ "</caption>");
checkOutput("pkg1/B.html", false,
"<caption><span>Methods</span><span class=\"tabEnd\">&nbsp;</span>"
+ "</caption>");
checkOutput("pkg1/D.html", false,
"<caption><span>Methods</span><span class=\"tabEnd\">&nbsp;</span>"
+ "</caption>");
}
}

View file

@ -26,29 +26,25 @@
* @bug 4210388
* @summary Javadoc declares interfaces to be "abstract".
* @author jamieh
* @library ../lib/
* @library ../lib
* @build ModifierAbstract
* @build JavadocTester
* @build TestModifier
* @run main TestModifier
*/
public class TestModifier extends JavadocTester {
private static final String[] ARGS =
new String[] {
"-sourcepath", SRC_DIR,
"-docletpath", SRC_DIR, "-doclet", "ModifierAbstract",
SRC_DIR + "/Interface.java", SRC_DIR + "/Test.java"};
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
public static void main(String... args) throws Exception {
TestModifier tester = new TestModifier();
if (tester.run(ARGS, NO_TEST, NO_TEST) != 0) {
throw new Error("Javadoc error occured during execution.");
}
tester.runTests();
}
@Test
void test() {
javadoc("-sourcepath", testSrc,
"-docletpath", testSrc,
"-doclet", "ModifierAbstract",
testSrc("Interface.java"), testSrc("Test.java"));
checkExit(Exit.OK);
}
}

View file

@ -27,49 +27,44 @@
* @summary Make sure the Next/Prev Class links iterate through all types.
* Make sure the navagation is 2 columns, not 3.
* @author jamieh
* @library ../lib/
* @build JavadocTester TestNavigation
* @library ../lib
* @build JavadocTester
* @run main TestNavigation
*/
public class TestNavigation extends JavadocTester {
//Javadoc arguments.
private static final String[] ARGS = new String[] {
"-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg"
};
//Input for string search tests.
private static final String[][] TEST = {
{ "pkg/A.html", "<li>Prev&nbsp;Class</li>"},
{ "pkg/A.html",
"<a href=\"../pkg/C.html\" title=\"class in pkg\"><span class=\"typeNameLink\">Next&nbsp;Class</span></a>"},
{ "pkg/C.html",
"<a href=\"../pkg/A.html\" title=\"annotation in pkg\"><span class=\"typeNameLink\">Prev&nbsp;Class</span></a>"},
{ "pkg/C.html",
"<a href=\"../pkg/E.html\" title=\"enum in pkg\"><span class=\"typeNameLink\">Next&nbsp;Class</span></a>"},
{ "pkg/E.html",
"<a href=\"../pkg/C.html\" title=\"class in pkg\"><span class=\"typeNameLink\">Prev&nbsp;Class</span></a>"},
{ "pkg/E.html",
"<a href=\"../pkg/I.html\" title=\"interface in pkg\"><span class=\"typeNameLink\">Next&nbsp;Class</span></a>"},
{ "pkg/I.html",
"<a href=\"../pkg/E.html\" title=\"enum in pkg\"><span class=\"typeNameLink\">Prev&nbsp;Class</span></a>"},
{ "pkg/I.html", "<li>Next&nbsp;Class</li>"},
// Test for 4664607
{ "pkg/I.html",
"<div class=\"skipNav\"><a href=\"#skip.navbar.top\" title=\"Skip navigation links\">Skip navigation links</a></div>\n" +
"<a name=\"navbar.top.firstrow\">\n" +
"<!-- -->\n" +
"</a>"}
};
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
public static void main(String... args) throws Exception {
TestNavigation tester = new TestNavigation();
tester.run(ARGS, TEST, NO_TEST);
tester.printSummary();
tester.runTests();
}
@Test
void test() {
javadoc("-d", "out",
"-sourcepath", testSrc,
"pkg");
checkExit(Exit.OK);
checkOutput("pkg/A.html", true,
"<li>Prev&nbsp;Class</li>",
"<a href=\"../pkg/C.html\" title=\"class in pkg\"><span class=\"typeNameLink\">Next&nbsp;Class</span></a>");
checkOutput("pkg/C.html", true,
"<a href=\"../pkg/A.html\" title=\"annotation in pkg\"><span class=\"typeNameLink\">Prev&nbsp;Class</span></a>",
"<a href=\"../pkg/E.html\" title=\"enum in pkg\"><span class=\"typeNameLink\">Next&nbsp;Class</span></a>");
checkOutput("pkg/E.html", true,
"<a href=\"../pkg/C.html\" title=\"class in pkg\"><span class=\"typeNameLink\">Prev&nbsp;Class</span></a>",
"<a href=\"../pkg/I.html\" title=\"interface in pkg\"><span class=\"typeNameLink\">Next&nbsp;Class</span></a>");
checkOutput("pkg/I.html", true,
"<a href=\"../pkg/E.html\" title=\"enum in pkg\"><span class=\"typeNameLink\">Prev&nbsp;Class</span></a>",
"<li>Next&nbsp;Class</li>",
// Test for 4664607
"<div class=\"skipNav\"><a href=\"#skip.navbar.top\" title=\"Skip navigation links\">Skip navigation links</a></div>\n"
+ "<a name=\"navbar.top.firstrow\">\n"
+ "<!-- -->\n"
+ "</a>");
}
}

View file

@ -26,35 +26,28 @@
* @bug 6758050 8025633
* @summary Test HTML output for nested generic types.
* @author bpatel
* @library ../lib/
* @build JavadocTester TestNestedGenerics
* @library ../lib
* @build JavadocTester
* @run main TestNestedGenerics
*/
public class TestNestedGenerics extends JavadocTester {
//Javadoc arguments.
private static final String[] ARGS = new String[]{
"-d", OUTPUT_DIR, "-sourcepath", SRC_DIR,
"pkg"
};
public static void main(String... args) throws Exception {
TestNestedGenerics tester = new TestNestedGenerics();
tester.runTests();
}
//Input for string search tests.
private static final String[][] TEST = {
{ "pkg/NestedGenerics.html",
@Test
void test() {
javadoc("-d", "out",
"-sourcepath", testSrc,
"pkg");
checkExit(Exit.OK);
checkOutput("pkg/NestedGenerics.html", true,
"<div class=\"block\">Contains <a " +
"href=\"../pkg/NestedGenerics.html#foo-java.util.Map-\"><code>foo" +
"(java.util.Map&lt;A, java.util.Map&lt;A, A&gt;&gt;)</code></a></div>"
}
};
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
TestNestedGenerics tester = new TestNestedGenerics();
tester.run(ARGS, TEST, NO_TEST);
tester.printSummary();
"(java.util.Map&lt;A, java.util.Map&lt;A, A&gt;&gt;)</code></a></div>");
}
}

View file

@ -25,12 +25,11 @@
* @test
* @summary Test for nested inline tags. *
* @author jamieh
* @library ../lib/
* @library ../lib
* @build JavadocTester
* @build testtaglets.UnderlineTaglet
* @build testtaglets.BoldTaglet
* @build testtaglets.GreenTaglet
* @build TestNestedInlineTag
* @run main TestNestedInlineTag
*/
@ -38,7 +37,6 @@
* This should be green, underlined and bold (Class): {@underline {@bold {@green My test}}} .
*/
public class TestNestedInlineTag extends JavadocTester {
/**
* This should be green, underlined and bold (Field): {@underline {@bold {@green My test}}} .
*/
@ -54,44 +52,35 @@ public class TestNestedInlineTag extends JavadocTester {
*/
public void method(){}
private static final String[][] TEST = {
//Test nested inline tag in class description.
{ "TestNestedInlineTag.html",
"This should be green, underlined and bold (Class): <u><b><font color=\"green\">My test</font></b></u>"
},
//Test nested inline tag in field description.
{ "TestNestedInlineTag.html",
"This should be green, underlined and bold (Field): <u><b><font color=\"green\">My test</font></b></u>"
},
//Test nested inline tag in constructor description.
{ "TestNestedInlineTag.html",
"This should be green, underlined and bold (Constructor): <u><b><font color=\"green\">My test</font></b></u>"
},
//Test nested inline tag in method description.
{ "TestNestedInlineTag.html",
"This should be green, underlined and bold (Method): <u><b><font color=\"green\">My test</font></b></u>"
}
};
private static final String[] ARGS =
new String[] {
"-d", OUTPUT_DIR, "-sourcepath", SRC_DIR,
"-taglet", "testtaglets.UnderlineTaglet",
"-taglet", "testtaglets.BoldTaglet",
"-taglet", "testtaglets.GreenTaglet",
SRC_DIR + "/TestNestedInlineTag.java"
};
/**
* The entry point of the test.
* @param args the array of command line arguments.
* @throws Exception if the test fails
*/
public static void main(String[] args) {
public static void main(String... args) throws Exception {
TestNestedInlineTag tester = new TestNestedInlineTag();
tester.run(ARGS, TEST, NO_TEST);
tester.printSummary();
tester.runTests();
}
@Test
void test() {
javadoc("-d", "out",
"-sourcepath", testSrc,
"-taglet", "testtaglets.UnderlineTaglet",
"-taglet", "testtaglets.BoldTaglet",
"-taglet", "testtaglets.GreenTaglet",
testSrc("TestNestedInlineTag.java"));
checkExit(Exit.OK);
checkOutput("TestNestedInlineTag.html", true,
//Test nested inline tag in class description.
"This should be green, underlined and bold (Class): <u><b><font color=\"green\">My test</font></b></u>",
//Test nested inline tag in field description.
"This should be green, underlined and bold (Field): <u><b><font color=\"green\">My test</font></b></u>",
//Test nested inline tag in constructor description.
"This should be green, underlined and bold (Constructor): <u><b><font color=\"green\">My test</font></b></u>",
//Test nested inline tag in method description.
"This should be green, underlined and bold (Method): <u><b><font color=\"green\">My test</font></b></u>"
);
}
}

View file

@ -27,31 +27,26 @@
* @summary Verify that packages.html is no longer generated since it is no
* longer used.
* @author jamieh
* @library ../lib/
* @library ../lib
* @build JavadocTester
* @build TestNoPackagesFile
* @run main TestNoPackagesFile
*/
public class TestNoPackagesFile extends JavadocTester {
//Javadoc arguments.
private static final String[] ARGS = new String[] {
"-d", OUTPUT_DIR, "-sourcepath", SRC_DIR,
SRC_DIR + "/C.java"
};
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
public static void main(String... args) throws Exception {
TestNoPackagesFile tester = new TestNoPackagesFile();
tester.run(ARGS, NO_TEST, NO_TEST);
if ((new java.io.File(OUTPUT_DIR + "/packages.html")).exists()) {
throw new Error("Test Fails: packages file should not be " + "generated anymore.");
} else {
System.out.println("Test passes: packages.html not found.");
}
tester.runTests();
}
@Test
void test() {
javadoc("-d", "out",
"-sourcepath", testSrc,
testSrc("C.java"));
checkExit(Exit.OK);
// packages.html file should not be generated anymore.
checkFiles(false, "packages.html");
}
}

View file

@ -26,31 +26,28 @@
* @bug 7001086
* @summary Test Non-frame warning.
* @author Bhavesh Patel
* @library ../lib/
* @build JavadocTester TestNonFrameWarning
* @library ../lib
* @build JavadocTester
* @run main TestNonFrameWarning
*/
public class TestNonFrameWarning extends JavadocTester {
private static final String[][] TEST = {
{ "index.html",
"<p>This document is designed to be viewed using the frames feature. " +
"If you see this message, you are using a non-frame-capable web client. " +
"Link to <a href=\"pkg/package-summary.html\">Non-frame version</a>.</p>"
}
};
private static final String[] ARGS = new String[]{
"-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg"
};
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
public static void main(String... args) throws Exception {
TestNonFrameWarning tester = new TestNonFrameWarning();
tester.run(ARGS, TEST, NO_TEST);
tester.printSummary();
tester.runTests();
}
@Test
void test() {
javadoc("-d", "out",
"-sourcepath", testSrc,
"pkg");
checkExit(Exit.OK);
checkOutput("index.html", true,
"<p>This document is designed to be viewed using the frames feature. "
+ "If you see this message, you are using a non-frame-capable web client. "
+ "Link to <a href=\"pkg/package-summary.html\">Non-frame version</a>.</p>");
}
}

View file

@ -28,50 +28,43 @@
* be created.
* Make sure classname is not include in javadoc usage message.
* @author jamieh
* @library ../lib/
* @library ../lib
* @build JavadocTester
* @build TestNotifications
* @run main TestNotifications
*/
public class TestNotifications extends JavadocTester {
//Javadoc arguments.
private static final String[] ARGS = new String[] {
"-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg"
};
private static final String[] ARGS2 = new String[] {
"-help"
};
//Input for string search tests.
private static final String[][] TEST = {
{NOTICE_OUTPUT, "Creating destination directory: \"" + OUTPUT_DIR}
};
private static final String[][] NEGATED_TEST = {
{NOTICE_OUTPUT, "Creating destination directory: \"" + OUTPUT_DIR}
};
private static final String[][] NEGATED_TEST2 = {
{NOTICE_OUTPUT, "[classnames]"}
};
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
public static void main(String... args) throws Exception {
TestNotifications tester = new TestNotifications();
tester.runTests();
}
@Test
void test1() {
String outDir = "out";
// Notify that the destination directory must be created.
tester.run(ARGS, TEST, NO_TEST);
javadoc("-d", outDir, "-sourcepath", testSrc, "pkg");
checkExit(Exit.OK);
checkOutput(Output.NOTICE, true,
"Creating destination directory: \"" + outDir);
// No need to notify that the destination must be created because
// it already exists.
tester.setCheckOutputDirectoryCheck(DirectoryCheck.NONE);
tester.run(ARGS, NO_TEST, NEGATED_TEST);
tester.setCheckOutputDirectoryCheck(DirectoryCheck.NO_HTML_FILES);
setOutputDirectoryCheck(DirectoryCheck.NONE);
javadoc("-d", outDir, "-sourcepath", testSrc, "pkg");
checkExit(Exit.OK);
checkOutput(Output.NOTICE, false,
"Creating destination directory: \"" + outDir);
}
@Test
void test() {
//Make sure classname is not include in javadoc usage message.
tester.run(ARGS2, NO_TEST, NEGATED_TEST2);
tester.printSummary();
setOutputDirectoryCheck(DirectoryCheck.NO_HTML_FILES);
javadoc("-help");
checkOutput(Output.NOTICE, false,
"[classnames]");
}
}

View file

@ -26,34 +26,30 @@
* @bug 4749567
* @summary Test the output for -header and -footer options.
* @author Bhavesh Patel
* @library ../lib/
* @build JavadocTester TestOptions
* @library ../lib
* @build JavadocTester
* @run main TestOptions
*/
public class TestOptions extends JavadocTester {
//Javadoc arguments.
private static final String[] ARGS = new String[] {
"-d", OUTPUT_DIR, "-header", "Test header", "-footer", "Test footer",
"-sourcepath", SRC_DIR, "pkg"
};
private static final String[][] TEST = {
{ "pkg/package-summary.html",
"<div class=\"aboutLanguage\">Test header</div>"},
{ "pkg/package-summary.html",
"<div class=\"aboutLanguage\">Test footer</div>"}
};
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
public static void main(String... args) throws Exception {
TestOptions tester = new TestOptions();
tester.run(ARGS, TEST, NO_TEST);
tester.printSummary();
tester.runTests();
}
@Test
void test() {
javadoc("-d", "out",
"-header", "Test header",
"-footer", "Test footer",
"-sourcepath", testSrc,
"pkg");
checkExit(Exit.OK);
checkOutput("pkg/package-summary.html", true,
"<div class=\"aboutLanguage\">Test header</div>",
"<div class=\"aboutLanguage\">Test footer</div>");
}
}

View file

@ -28,86 +28,89 @@
* @author ksrini
* @library ../lib/
* @build JavadocTester
* @build TestOrdering
* @run main TestOrdering
*/
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class TestOrdering extends JavadocTester {
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) throws Exception {
TestOrdering tester = new TestOrdering();
// test unnamed packages
String[] ARGS = {
"-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "-use",
SRC_DIR + "/C.java", SRC_DIR + "/UsedInC.java"
};
tester.runJavadoc(ARGS);
checkExecutableMemberOrdering(tester.readFileToString("class-use/UsedInC.html"));
// next test using packages
String[] ARGS1 = {
"-d", OUTPUT_DIR + "-1", "-sourcepath", SRC_DIR, "-use",
"pkg1"
};
tester.runJavadoc(ARGS1);
checkClassUseOrdering(tester.readFileToString("pkg1/class-use/UsedClass.html"));
checkIndexPathOrdering(tester.readFileToString("index-all.html"));
tester.runTests();
}
static void checkExecutableMemberOrdering(String usePage) {
@Test
void testUnnamedPackages() {
javadoc("-d", "out",
"-sourcepath", testSrc,
"-use",
testSrc("C.java"), testSrc("UsedInC.java"));
checkExit(Exit.OK);
checkExecutableMemberOrdering("class-use/UsedInC.html");
}
@Test
void testNamedPackages() {
javadoc("-d", "out-1",
"-sourcepath", testSrc,
"-use",
"pkg1");
checkExit(Exit.OK);
checkClassUseOrdering("pkg1/class-use/UsedClass.html");
checkIndexPathOrdering("index-all.html");
}
void checkExecutableMemberOrdering(String usePage) {
String contents = readFile(usePage);
// check constructors
int idx1 = usePage.indexOf("C.html#C-UsedInC");
int idx2 = usePage.indexOf("C.html#C-UsedInC-int");
int idx3 = usePage.indexOf("C.html#C-UsedInC-java.lang.String");
checking("constructors");
int idx1 = contents.indexOf("C.html#C-UsedInC");
int idx2 = contents.indexOf("C.html#C-UsedInC-int");
int idx3 = contents.indexOf("C.html#C-UsedInC-java.lang.String");
if (idx1 == -1 || idx2 == -1 || idx3 == -1) {
throw new Error("ctor strings not found");
}
if (idx1 > idx2 || idx2 > idx3 || idx1 > idx3) {
throw new Error("ctor strings are out of order");
}
failed("ctor strings not found");
} else if (idx1 > idx2 || idx2 > idx3 || idx1 > idx3) {
failed("ctor strings are out of order");
} else
passed("ctor strings are in order");
// check methods
idx1 = usePage.indexOf("C.html#ymethod-int");
idx2 = usePage.indexOf("C.html#ymethod-java.lang.String");
checking("methods");
idx1 = contents.indexOf("C.html#ymethod-int");
idx2 = contents.indexOf("C.html#ymethod-java.lang.String");
if (idx1 == -1 || idx2 == -1) {
throw new Error("#ymethod strings not found");
}
if (idx1 > idx2) {
throw new Error("#ymethod strings are out of order");
}
System.out.println("Executable Member Ordering: OK");
failed("#ymethod strings not found");
} else if (idx1 > idx2) {
failed("#ymethod strings are out of order");
} else
passed("Executable Member Ordering: OK");
}
static void checkClassUseOrdering(String usePage) {
void checkClassUseOrdering(String usePage) {
checkClassUseOrdering(usePage, "pkg1/C#ITERATION#.html#zfield");
checkClassUseOrdering(usePage, "pkg1/C#ITERATION#.html#fieldInC#ITERATION#");
checkClassUseOrdering(usePage, "pkg1/C#ITERATION#.html#zmethod-pkg1.UsedClass");
checkClassUseOrdering(usePage, "pkg1/C#ITERATION#.html#methodInC#ITERATION#");
}
static void checkClassUseOrdering(String usePage, String searchString) {
void checkClassUseOrdering(String usePage, String searchString) {
String contents = readFile(usePage);
int lastidx = 0;
System.out.println("testing for " + searchString);
for (int i = 1; i < 5; i++) {
String s = searchString.replaceAll("#ITERATION#", Integer.toString(i));
System.out.println(s);
int idx = usePage.indexOf(s);
checking(s);
int idx = contents.indexOf(s);
if (idx < lastidx) {
throw new Error(s + ", member ordering error, last:" + lastidx + ", got:" + idx);
failed(s + ", member ordering error, last:" + lastidx + ", got:" + idx);
} else {
passed("\tlast: " + lastidx + " got:" + idx);
}
System.out.println("\tlast: " + lastidx + " got:" + idx);
lastidx = idx;
}
}
static void checkIndexPathOrdering(String indexPage) {
String[] OrderedExpectedStrings = {
void checkIndexPathOrdering(String indexPage) {
checkOrder(indexPage,
"pkg1/UsedClass.html#add--",
"pkg1/ZZTop.html#add--",
"pkg1/UsedClass.html#add-double-",
@ -129,16 +132,6 @@ public class TestOrdering extends JavadocTester {
"pkg1/UsedClass.html#add-int-float-",
"pkg1/ZZTop.html#add-int-float-",
"pkg1/UsedClass.html#add-java.lang.Integer-",
"pkg1/ZZTop.html#add-java.lang.Integer-"
};
int lastidx = 0;
for (String x : OrderedExpectedStrings) {
int idx = indexPage.indexOf(x);
if (idx < lastidx) {
throw new Error(x + ", index is out of order, last:" + lastidx + ", got:" + idx);
}
System.out.println(x + ": OK");
lastidx = idx;
}
"pkg1/ZZTop.html#add-java.lang.Integer-");
}
}

View file

@ -27,59 +27,54 @@
* @summary Make sure that all inherited methods from multiple extended
* interfaces are documented
* @author jamieh
* @library ../lib/
* @library ../lib
* @build JavadocTester
* @build TestMultiInheritence
* @run main TestMultiInheritence
*/
// TODO: should be TestMultiInheritance
public class TestMultiInheritence extends JavadocTester {
//Javadoc arguments.
private static final String[] ARGS = new String[] {
"-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg3"
};
public static void main(String... args) throws Exception {
TestMultiInheritence tester = new TestMultiInheritence();
tester.runTests();
}
@Test
void test() {
javadoc("-d", "out",
"-sourcepath", testSrc,
"pkg3");
checkExit(Exit.OK);
// Method foo() is inherited from BOTH I2 and I3
private static final String[][] TEST = {
{ "pkg3/I1.html",
"Methods inherited from interface&nbsp;pkg3." +
"<a href=\"../pkg3/I2.html\" title=\"interface in pkg3\">" +
"I2</a>"},
{ "pkg3/I1.html",
"Methods inherited from interface&nbsp;pkg3." +
"<a href=\"../pkg3/I3.html\" title=\"interface in pkg3\">" +
"I3</a>"},
{ "pkg3/I0.html",
"Methods inherited from interface&nbsp;pkg3." +
"<a href=\"../pkg3/I2.html\" title=\"interface in pkg3\">" +
"I2</a>"},
{ "pkg3/I0.html",
"Methods inherited from interface&nbsp;pkg3." +
"<a href=\"../pkg3/I3.html\" title=\"interface in pkg3\">" +
"I3</a>"},
};
//Method foo() is NOT inherited from I4 because it is overriden by
//I3.
private static final String[][] NEGATED_TEST = {
{ "pkg3/I1.html",
"Methods inherited from interface&nbsp;pkg3." +
"<a href=\"../pkg3/I4.html\" title=\"interface in pkg3\">" +
"I4</a>"},
{ "pkg3/I0.html",
"Methods inherited from interface&nbsp;pkg3." +
"<a href=\"../pkg3/I4.html\" title=\"interface in pkg3\">" +
"I4</a>"},
};
checkOutput("pkg3/I1.html", true,
"Methods inherited from interface&nbsp;pkg3."
+ "<a href=\"../pkg3/I2.html\" title=\"interface in pkg3\">"
+ "I2</a>",
"Methods inherited from interface&nbsp;pkg3."
+ "<a href=\"../pkg3/I3.html\" title=\"interface in pkg3\">"
+ "I3</a>");
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
TestMultiInheritence tester = new TestMultiInheritence();
tester.run(ARGS, TEST, NEGATED_TEST);
tester.printSummary();
checkOutput("pkg3/I0.html", true,
"Methods inherited from interface&nbsp;pkg3."
+ "<a href=\"../pkg3/I2.html\" title=\"interface in pkg3\">"
+ "I2</a>",
"Methods inherited from interface&nbsp;pkg3."
+ "<a href=\"../pkg3/I3.html\" title=\"interface in pkg3\">"
+ "I3</a>");
// Method foo() is NOT inherited from I4 because it is overriden by I3.
checkOutput("pkg3/I1.html", false,
"Methods inherited from interface&nbsp;pkg3."
+ "<a href=\"../pkg3/I4.html\" title=\"interface in pkg3\">"
+ "I4</a>");
checkOutput("pkg3/I0.html", false,
"Methods inherited from interface&nbsp;pkg3."
+ "<a href=\"../pkg3/I4.html\" title=\"interface in pkg3\">"
+ "I4</a>");
}
}

View file

@ -27,35 +27,32 @@
* @summary Inherited comment should link directly to member, not just
* class
* @author jamieh
* @library ../lib/
* @library ../lib
* @build JavadocTester
* @build TestOverridenMethodDocCopy
* @run main TestOverridenMethodDocCopy
*/
public class TestOverridenMethodDocCopy extends JavadocTester {
//Javadoc arguments.
private static final String[] ARGS = new String[] {
"-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg1", "pkg2"
};
//Input for string search tests.
private static final String[][] TEST = {
{ "pkg1/SubClass.html",
"<span class=\"descfrmTypeLabel\">Description copied from class:&nbsp;<code>" +
"<a href=\"../pkg1/BaseClass.html#overridenMethodWithDocsToCopy--\">" +
"BaseClass</a></code></span>"
}
};
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
public static void main(String... args) throws Exception {
TestOverridenMethodDocCopy tester = new TestOverridenMethodDocCopy();
tester.run(ARGS, TEST, NO_TEST);
tester.printSummary();
tester.runTests();
}
@Test
void test() {
javadoc("-d", "out",
"-sourcepath", testSrc,
"pkg1", "pkg2");
checkExit(Exit.OK);
checkOutput("pkg1/SubClass.html", true,
"<span class=\"descfrmTypeLabel\">Description copied from class:&nbsp;<code>"
+ "<a href=\"../pkg1/BaseClass.html#overridenMethodWithDocsToCopy--\">"
+ "BaseClass</a></code></span>");
}
}

View file

@ -27,61 +27,50 @@
* @summary Determine if overriden methods are properly documented when
* -protected (default) visibility flag is used.
* @author jamieh
* @library ../lib/
* @library ../lib
* @build JavadocTester
* @build TestOverridenPrivateMethods
* @run main TestOverridenPrivateMethods
*/
public class TestOverridenPrivateMethods extends JavadocTester {
private static final String[][] TEST = {
//The public method should be overriden
{ "pkg1/SubClass.html",
"<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n" +
"<dd><code><a href=\"../pkg1/BaseClass.html#publicMethod"},
//The public method in different package should be overriden
{ "pkg2/SubClass.html",
"<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n" +
"<dd><code><a href=\"../pkg1/BaseClass.html#publicMethod"}
};
private static final String[][] NEGATED_TEST = {
//The package private method should be overriden since the base and sub class are in the same
//package. However, the link should not show up because the package private methods are not documented.
{ "pkg1/SubClass.html",
"<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n" +
"<dd><code><a href=\"../pkg1/BaseClass.html#packagePrivateMethod"},
//The private method in should not be overriden
{ "pkg1/SubClass.html",
"<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n" +
"<dd><code><a href=\"../pkg1/BaseClass.html#privateMethod"},
//The private method in different package should not be overriden
{ "pkg2/SubClass.html",
"<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n" +
"<dd><code><a href=\"../pkg1/BaseClass.html#privateMethod"},
//The package private method should not be overriden since the base and sub class are in
//different packages.
{ "pkg2/SubClass.html",
"Overrides:</span></dt><dd><code><a href=\"../pkg1/BaseClass.html#packagePrivateMethod"}
};
private static final String[] ARGS =
new String[] {
"-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg1", "pkg2"};
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
public static void main(String... args) throws Exception {
TestOverridenPrivateMethods tester = new TestOverridenPrivateMethods();
tester.run(ARGS, TEST, NEGATED_TEST);
tester.printSummary();
tester.runTests();
}
@Test
void test() {
javadoc("-d", "out",
"-sourcepath", testSrc,
"pkg1", "pkg2");
checkExit(Exit.OK);
// The public method should be overridden
checkOutput("pkg1/SubClass.html", true,
"<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n"
+ "<dd><code><a href=\"../pkg1/BaseClass.html#publicMethod");
// The public method in different package should be overridden
checkOutput("pkg2/SubClass.html", true,
"<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n"
+ "<dd><code><a href=\"../pkg1/BaseClass.html#publicMethod");
checkOutput("pkg1/SubClass.html", false,
//The package private method should be overridden since the base and sub class are in the same
//package. However, the link should not show up because the package private methods are not documented.
"<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n"
+ "<dd><code><a href=\"../pkg1/BaseClass.html#packagePrivateMethod",
//The private method in should not be overridden
"<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n"
+ "<dd><code><a href=\"../pkg1/BaseClass.html#privateMethod");
checkOutput("pkg2/SubClass.html", false,
//The private method in different package should not be overridden
"<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n"
+ "<dd><code><a href=\"../pkg1/BaseClass.html#privateMethod",
//The package private method should not be overridden since the base and sub class are in
//different packages.
"Overrides:</span></dt><dd><code><a href=\"../pkg1/BaseClass.html#packagePrivateMethod");
}
}

View file

@ -24,71 +24,65 @@
/*
* @test
* @bug 4634891 8025633 8026567
* @summary Determine if overriden methods are properly documented when
* @summary Determine if overridden methods are properly documented when
* -protected (default) visibility flag is used.
* @author jamieh
* @library ../lib/
* @library ../lib
* @build JavadocTester
* @build TestOverridenPrivateMethodsWithPackageFlag
* @run main TestOverridenPrivateMethodsWithPackageFlag
*/
public class TestOverridenPrivateMethodsWithPackageFlag extends JavadocTester {
private static final String[][] TEST = {
//The public method should be overriden
{ "pkg1/SubClass.html",
"<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n" +
"<dd><code><a href=\"../pkg1/BaseClass.html#publicMethod--\">" +
"publicMethod</a></code>&nbsp;in class&nbsp;<code>" +
"<a href=\"../pkg1/BaseClass.html\" title=\"class in pkg1\">BaseClass</a></code></dd>"},
//The public method in different package should be overriden
{ "pkg2/SubClass.html",
"<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n" +
"<dd><code><a href=\"../pkg1/BaseClass.html#publicMethod--\">" +
"publicMethod</a></code>&nbsp;in class&nbsp;<code>" +
"<a href=\"../pkg1/BaseClass.html\" title=\"class in pkg1\">BaseClass</a></code></dd>"},
//The package private method should be overriden since the base and sub class are in the same
//package.
{ "pkg1/SubClass.html",
"<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n" +
"<dd><code><a href=\"../pkg1/BaseClass.html#packagePrivateMethod--\">" +
"packagePrivateMethod</a></code>&nbsp;in class&nbsp;<code>" +
"<a href=\"../pkg1/BaseClass.html\" title=\"class in pkg1\">BaseClass</a></code></dd>"}
};
private static final String[][] NEGATED_TEST = {
//The private method in should not be overriden
{ "pkg1/SubClass.html",
"<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n" +
"<dd><code><a href=\"../pkg1/BaseClass.html#privateMethod()\">"},
//The private method in different package should not be overriden
{ "pkg2/SubClass.html",
"<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n" +
"<dd><code><a href=\"../pkg1/BaseClass.html#privateMethod()\">"},
//The package private method should not be overriden since the base and sub class are in
//different packages.
{ "pkg2/SubClass.html",
"<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n" +
"<dd><code><a href=\"../pkg1/BaseClass.html#packagePrivateMethod()\">"},
};
private static final String[] ARGS =
new String[] {
"-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "-package", "pkg1", "pkg2"};
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
public static void main(String... args) throws Exception {
TestOverridenPrivateMethodsWithPackageFlag tester = new TestOverridenPrivateMethodsWithPackageFlag();
tester.run(ARGS, TEST, NEGATED_TEST);
tester.printSummary();
tester.runTests();
}
@Test
void test() {
javadoc("-d", "out",
"-sourcepath", testSrc,
"-package",
"pkg1", "pkg2");
checkExit(Exit.OK);
// The public method should be overridden
checkOutput("pkg1/SubClass.html", true,
"<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n"
+ "<dd><code><a href=\"../pkg1/BaseClass.html#publicMethod--\">"
+ "publicMethod</a></code>&nbsp;in class&nbsp;<code>"
+ "<a href=\"../pkg1/BaseClass.html\" title=\"class in pkg1\">BaseClass</a></code></dd>");
// The public method in different package should be overridden
checkOutput("pkg2/SubClass.html", true,
"<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n"
+ "<dd><code><a href=\"../pkg1/BaseClass.html#publicMethod--\">"
+ "publicMethod</a></code>&nbsp;in class&nbsp;<code>"
+ "<a href=\"../pkg1/BaseClass.html\" title=\"class in pkg1\">BaseClass</a></code></dd>");
// The package private method should be overridden since the base and sub class are in the same
// package.
checkOutput("pkg1/SubClass.html", true,
"<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n"
+ "<dd><code><a href=\"../pkg1/BaseClass.html#packagePrivateMethod--\">"
+ "packagePrivateMethod</a></code>&nbsp;in class&nbsp;<code>"
+ "<a href=\"../pkg1/BaseClass.html\" title=\"class in pkg1\">BaseClass</a></code></dd>");
// The private method in should not be overridden
checkOutput("pkg1/SubClass.html", false,
"<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n"
+ "<dd><code><a href=\"../pkg1/BaseClass.html#privateMethod()\">");
// The private method in different package should not be overridden
checkOutput("pkg2/SubClass.html", false,
"<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n"
+ "<dd><code><a href=\"../pkg1/BaseClass.html#privateMethod()\">");
// The package private method should not be overridden since the base and sub class are in
// different packages.
checkOutput("pkg2/SubClass.html", false,
"<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n"
+ "<dd><code><a href=\"../pkg1/BaseClass.html#packagePrivateMethod()\">");
}
}

View file

@ -24,67 +24,59 @@
/*
* @test
* @bug 4634891 8026567
* @summary Determine if overriden methods are properly documented when
* @summary Determine if overridden methods are properly documented when
* -protected (default) visibility flag is used.
* @author jamieh
* @library ../lib/
* @library ../lib
* @build JavadocTester
* @build TestOverridenPrivateMethodsWithPrivateFlag
* @run main TestOverridenPrivateMethodsWithPrivateFlag
*/
public class TestOverridenPrivateMethodsWithPrivateFlag extends JavadocTester {
private static final String[][] TEST = {
//The public method should be overriden
{ "pkg1/SubClass.html",
"<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n" +
"<dd><code><a href=\"../pkg1/BaseClass.html#publicMethod"},
//The package private method should be overriden since the base and sub class are in the same
//package.
{ "pkg1/SubClass.html",
"<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n" +
"<dd><code><a href=\"../pkg1/BaseClass.html#packagePrivateMethod"},
//The public method in different package should be overriden
{ "pkg2/SubClass.html",
"<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n" +
"<dd><code><a href=\"../pkg1/BaseClass.html#publicMethod"},
};
private static final String[][] NEGATED_TEST = {
//The private method in should not be overriden
{ "pkg1/SubClass.html",
"<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n" +
"<dd><code><a href=\"../pkg1/BaseClass.html#privateMethod"},
//The private method in different package should not be overriden
{ "pkg2/SubClass.html",
"<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n" +
"<dd><code><a href=\"../pkg1/BaseClass.html#privateMethod"},
//The package private method should not be overriden since the base and sub class are in
//different packages.
{ "pkg2/SubClass.html",
"<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n" +
"<dd><code><a href=\"../pkg1/BaseClass.html#packagePrivateMethod"}
};
private static final String[] ARGS =
new String[] {
"-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "-private", "pkg1", "pkg2"};
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
public static void main(String... args) throws Exception {
TestOverridenPrivateMethodsWithPrivateFlag tester = new TestOverridenPrivateMethodsWithPrivateFlag();
tester.run(ARGS, TEST, NEGATED_TEST);
tester.printSummary();
tester.runTests();
}
@Test
void test() {
javadoc("-d", "out",
"-sourcepath", testSrc,
"-private",
"pkg1", "pkg2");
checkExit(Exit.OK);
// The public method should be overridden
checkOutput("pkg1/SubClass.html", true,
"<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n" +
"<dd><code><a href=\"../pkg1/BaseClass.html#publicMethod");
// The package private method should be overridden since the base and sub class are in the same
// package.
checkOutput("pkg1/SubClass.html", true,
"<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n" +
"<dd><code><a href=\"../pkg1/BaseClass.html#packagePrivateMethod");
// The public method in different package should be overridden
checkOutput("pkg2/SubClass.html", true,
"<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n" +
"<dd><code><a href=\"../pkg1/BaseClass.html#publicMethod");
// The private method in should not be overridden
checkOutput("pkg1/SubClass.html", false,
"<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n" +
"<dd><code><a href=\"../pkg1/BaseClass.html#privateMethod");
// The private method in different package should not be overridden
checkOutput("pkg2/SubClass.html", false,
"<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n" +
"<dd><code><a href=\"../pkg1/BaseClass.html#privateMethod");
// The package private method should not be overridden since the base and sub class are in
// different packages.
checkOutput("pkg2/SubClass.html", false,
"<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n" +
"<dd><code><a href=\"../pkg1/BaseClass.html#packagePrivateMethod");
}
}

View file

@ -33,53 +33,46 @@
public class TestPackageDeprecation extends JavadocTester {
//Javadoc arguments.
private static final String[] ARGS1 = new String[]{
"-d", OUTPUT_DIR + "-1", "-sourcepath", SRC_DIR, "-use", "pkg", "pkg1",
SRC_DIR + "/C2.java", SRC_DIR + "/FooDepr.java"
};
private static final String[] ARGS2 = new String[]{
"-d", OUTPUT_DIR + "-2", "-sourcepath", SRC_DIR, "-use", "-nodeprecated",
"pkg", "pkg1", SRC_DIR + "/C2.java", SRC_DIR + "/FooDepr.java"
};
public static void main(String... args) throws Exception {
TestPackageDeprecation tester = new TestPackageDeprecation();
tester.runTests();
}
//Input for string search tests.
private static final String[][] TEST1 = {
{ "pkg1/package-summary.html",
@Test
void testDefault() {
javadoc("-d", "out-default",
"-sourcepath", testSrc,
"-use",
"pkg", "pkg1", testSrc("C2.java"), testSrc("FooDepr.java"));
checkExit(Exit.OK);
checkOutput("pkg1/package-summary.html", true,
"<div class=\"deprecatedContent\"><span class=\"deprecatedLabel\">Deprecated.</span>\n" +
"<div class=\"block\"><span class=\"deprecationComment\">This package is Deprecated." +
"</span></div>"
},
{ "deprecated-list.html",
"<li><a href=\"#package\">Deprecated Packages</a></li>"
}
};
private static final String[][] NEGATED_TEST2 = {
{ "overview-summary.html", "pkg1"},
{ "allclasses-frame.html", "FooDepr"}
};
);
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
TestPackageDeprecation tester = new TestPackageDeprecation();
tester.run(ARGS1, TEST1, NO_TEST);
tester.run(ARGS2, NO_TEST, NEGATED_TEST2);
if ((new java.io.File(OUTPUT_DIR + "-2/pkg1/" +
"package-summary.html")).exists()) {
throw new Error("Test Fails: packages summary should not be" +
"generated for deprecated package.");
} else {
System.out.println("Test passes: package-summary.html not found.");
checkOutput("deprecated-list.html", true,
"<li><a href=\"#package\">Deprecated Packages</a></li>"
);
}
if ((new java.io.File(OUTPUT_DIR + "-2/FooDepr.html")).exists()) {
throw new Error("Test Fails: FooDepr should not be" +
"generated as it is deprecated.");
} else {
System.out.println("Test passes: FooDepr.html not found.");
}
tester.printSummary();
@Test
void testNoDeprecated() {
javadoc("-d", "out-nodepr",
"-sourcepath", testSrc,
"-use",
"-nodeprecated",
"pkg", "pkg1", testSrc("C2.java"), testSrc("FooDepr.java"));
checkExit(Exit.OK);
checkOutput("overview-summary.html", false,
"pkg1");
checkOutput("allclasses-frame.html", false,
"FooDepr");
checkFiles(false,
"pkg1/package-summary.html",
"FooDepr.html");
}
}

Some files were not shown because too many files have changed in this diff Show more