test/com/sun/javadoc/lib/JavadocTester.java

changeset 389
0ba956343648
parent 174
fdfed22db054
child 404
14735c7932d7
equal deleted inserted replaced
388:477c5bf1149c 389:0ba956343648
122 * The current run of javadoc 122 * The current run of javadoc
123 */ 123 */
124 private static int javadocRunNum = 0; 124 private static int javadocRunNum = 0;
125 125
126 /** 126 /**
127 * Whether or not to match newlines exactly.
128 * Set this value to false if the match strings
129 * contain text from javadoc comments containing
130 * non-platform newlines.
131 */
132 protected boolean exactNewlineMatch = true;
133
134 /**
127 * Construct a JavadocTester. 135 * Construct a JavadocTester.
128 */ 136 */
129 public JavadocTester() { 137 public JavadocTester() {
130 } 138 }
131 139
417 } 425 }
418 426
419 /** 427 /**
420 * Search for the string in the given file and return true 428 * Search for the string in the given file and return true
421 * if the string was found. 429 * if the string was found.
430 * If exactNewlineMatch is false, newlines will be normalized
431 * before the comparison.
422 * 432 *
423 * @param fileString the contents of the file to search through 433 * @param fileString the contents of the file to search through
424 * @param stringToFind the string to search for 434 * @param stringToFind the string to search for
425 * @return true if the string was found 435 * @return true if the string was found
426 */ 436 */
427 private boolean findString(String fileString, String stringToFind) { 437 private boolean findString(String fileString, String stringToFind) {
428 return fileString.indexOf(stringToFind) >= 0; 438 if (exactNewlineMatch) {
429 } 439 return fileString.indexOf(stringToFind) >= 0;
440 } else {
441 return fileString.replace(NL, "\n").indexOf(stringToFind.replace(NL, "\n")) >= 0;
442 }
443 }
444
430 445
431 /** 446 /**
432 * Return the standard output. 447 * Return the standard output.
433 * @return the standard output 448 * @return the standard output
434 */ 449 */

mercurial