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

changeset 389
0ba956343648
parent 174
fdfed22db054
child 404
14735c7932d7
     1.1 --- a/test/com/sun/javadoc/lib/JavadocTester.java	Thu Aug 27 18:25:21 2009 -0700
     1.2 +++ b/test/com/sun/javadoc/lib/JavadocTester.java	Fri Aug 28 12:12:08 2009 -0700
     1.3 @@ -124,6 +124,14 @@
     1.4      private static int javadocRunNum = 0;
     1.5  
     1.6      /**
     1.7 +     * Whether or not to match newlines exactly.
     1.8 +     * Set this value to false if the match strings
     1.9 +     * contain text from javadoc comments containing
    1.10 +     * non-platform newlines.
    1.11 +     */
    1.12 +    protected boolean exactNewlineMatch = true;
    1.13 +
    1.14 +    /**
    1.15       * Construct a JavadocTester.
    1.16       */
    1.17      public JavadocTester() {
    1.18 @@ -419,15 +427,22 @@
    1.19      /**
    1.20       * Search for the string in the given file and return true
    1.21       * if the string was found.
    1.22 +     * If exactNewlineMatch is false, newlines will be normalized
    1.23 +     * before the comparison.
    1.24       *
    1.25       * @param fileString    the contents of the file to search through
    1.26       * @param stringToFind  the string to search for
    1.27       * @return              true if the string was found
    1.28       */
    1.29      private boolean findString(String fileString, String stringToFind) {
    1.30 -        return fileString.indexOf(stringToFind) >= 0;
    1.31 +        if (exactNewlineMatch) {
    1.32 +            return fileString.indexOf(stringToFind) >= 0;
    1.33 +        } else {
    1.34 +            return fileString.replace(NL, "\n").indexOf(stringToFind.replace(NL, "\n")) >= 0;
    1.35 +        }
    1.36      }
    1.37  
    1.38 +
    1.39      /**
    1.40       * Return the standard output.
    1.41       * @return the standard output

mercurial