langtools/test/com/sun/javadoc/lib/JavadocTester.java
changeset 3771 6e7b16ecca30
parent 1652 1324f96f3883
child 3890 b53fced26fa4
--- a/langtools/test/com/sun/javadoc/lib/JavadocTester.java	Thu Aug 27 18:25:21 2009 -0700
+++ b/langtools/test/com/sun/javadoc/lib/JavadocTester.java	Fri Aug 28 12:12:08 2009 -0700
@@ -124,6 +124,14 @@
     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.
      */
     public JavadocTester() {
@@ -419,15 +427,22 @@
     /**
      * 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