/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 4524350 4662945 4633447
* @summary stddoclet: {@docRoot} inserts an extra trailing "/"
* @author dkramer
* @run main DocRootSlash
*/
/**
* 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 DocRootSlash
{
// Test number. Needed because runResultsOnHTMLFile is run twice, and subtestNum
// should increment across test runs.
// Entry point
// Directory that contains source files that javadoc runs on
"-header", "<A HREF=\"{@docroot}/package-list\">{@docroot}</A> <A HREF=\"{@docRoot}/help-doc\">{@docRoot}</A>",
"-sourcepath", srcdir,
"p1", "p2"});
printSummary();
}
/** Run javadoc */
throw new Error("Javadoc failed to execute");
}
}
/** The array of filenames to test */
};
// Bugs 4524350 4662945
// Read contents of file (whose filename is in filenames) into a string
+ " --------------");
// 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
}
}
// Bug 4633447: Special test for overview-frame.html
// Find two strings in file "overview-frame.html"
// Find first string <A HREF="./package-list"> in overview-frame.html
subtestNum += 1;
result = "FAILED";
} else {
result = "succeeded";
numOfSubtestsPassed += 1;
}
+ "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\">";
result = "FAILED";
} else {
result = "succeeded";
numOfSubtestsPassed += 1;
}
+ "when searching for:\n"
+ stringToFind + "\n"
+ "in file " + filename);
}
public static void printSummary() {
if ( numOfSubtestsPassed == subtestNum ) {
} else {
}
}
// Read the contents of the file into a String
try {
}
// Create an array of characters the size of the file
// Read the characters into the allChars array
// Convert to a string
return allCharsString;
} catch (FileNotFoundException e) {
return "";
} catch (IOException e) {
return "";
}
}
/**
* Regular expression pattern matching code adapted from Eric's
*
* Prefix Pattern:
* flag (?i) (case insensitive, so "a href" == "A HREF" and all combinations)
* group1 (
* <a or <A
* \\s+ (one or more whitespace characters)
* href or HREF
* \" (double quote)
* )
* group2 ([^\"]*) (link reference -- characters that don't include a quote)
* group3 (\".*?>) (" target="frameName">)
* group4 (.*?) (label - zero or more characters)
* group5 (</a>) (end tag)
*/
/**
* Compares the actual string to the expected string in the specified string
* str String to search through
*/
// Pattern must be compiled each run because subtestNum is incremented
// Pattern linkPattern2 = Pattern.compile(prefix + ref2 + label + end, Pattern.DOTALL);
result = "succeeded";
numOfSubtestsPassed += 1;
// System.out.println("pattern: " + actualLinkPattern1.pattern());
// System.out.println("actualRef: " + actualRef);
// System.out.println("group0: " + actualLinkMatcher1.group());
// System.out.println("group1: " + actualLinkMatcher1.group(1));
// System.out.println("group2: " + actualLinkMatcher1.group(2));
// System.out.println("group3: " + actualLinkMatcher1.group(3));
// System.exit(0);
} else {
result = "FAILED";
}
} else {
+ expectLinkPattern1.pattern() );
}
}
}