6876782: two javadoc tests fail on Windows

Reviewed-by: darcy
This commit is contained in:
Jonathan Gibbons 2009-08-28 12:12:08 -07:00
parent 944568ba4b
commit e4158efc0e
3 changed files with 18 additions and 1 deletions

View file

@ -123,6 +123,14 @@ public abstract class JavadocTester {
*/
private static int javadocRunNum = 0;
/**
* Whether or not to match newlines exactly.
* Set this value to false if the match strings
* contain text from javadoc comments containing
* non-platform newlines.
*/
protected boolean exactNewlineMatch = true;
/**
* Construct a JavadocTester.
*/
@ -419,15 +427,22 @@ public abstract class JavadocTester {
/**
* Search for the string in the given file and return true
* if the string was found.
* If exactNewlineMatch is false, newlines will be normalized
* before the comparison.
*
* @param fileString the contents of the file to search through
* @param stringToFind the string to search for
* @return true if the string was found
*/
private boolean findString(String fileString, String stringToFind) {
return fileString.indexOf(stringToFind) >= 0;
if (exactNewlineMatch) {
return fileString.indexOf(stringToFind) >= 0;
} else {
return fileString.replace(NL, "\n").indexOf(stringToFind.replace(NL, "\n")) >= 0;
}
}
/**
* Return the standard output.
* @return the standard output