changeset 388:0ba956343648

6876782: two javadoc tests fail on Windows Reviewed-by: darcy
author jjg
date Fri, 28 Aug 2009 12:12:08 -0700
parents 477c5bf1149c
children f0c9fc46990b
files test/com/sun/javadoc/lib/JavadocTester.java test/com/sun/javadoc/testHtmlDefinitionListTag/TestHtmlDefinitionListTag.java test/com/sun/javadoc/testSerializedFormDeprecationInfo/TestSerializedFormDeprecationInfo.java
diffstat 3 files changed, 18 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/test/com/sun/javadoc/lib/JavadocTester.java	Thu Aug 27 18:25:21 2009 -0700
+++ b/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
--- a/test/com/sun/javadoc/testHtmlDefinitionListTag/TestHtmlDefinitionListTag.java	Thu Aug 27 18:25:21 2009 -0700
+++ b/test/com/sun/javadoc/testHtmlDefinitionListTag/TestHtmlDefinitionListTag.java	Fri Aug 28 12:12:08 2009 -0700
@@ -351,6 +351,7 @@
      */
     public static void main(String[] args) {
         TestHtmlDefinitionListTag tester = new TestHtmlDefinitionListTag();
+        tester.exactNewlineMatch = false;
         run(tester, ARGS1, TEST_ALL, NEGATED_TEST);
         run(tester, ARGS1, TEST_CMNT_DEPR, NEGATED_TEST);
         run(tester, ARGS2, TEST_ALL, NEGATED_TEST);
--- a/test/com/sun/javadoc/testSerializedFormDeprecationInfo/TestSerializedFormDeprecationInfo.java	Thu Aug 27 18:25:21 2009 -0700
+++ b/test/com/sun/javadoc/testSerializedFormDeprecationInfo/TestSerializedFormDeprecationInfo.java	Fri Aug 28 12:12:08 2009 -0700
@@ -128,6 +128,7 @@
      */
     public static void main(String[] args) {
         TestSerializedFormDeprecationInfo tester = new TestSerializedFormDeprecationInfo();
+        tester.exactNewlineMatch = false;
         run(tester, ARGS1, TEST_CMNT_DEPR, TEST_NOCMNT);
         run(tester, ARGS2, TEST_NOCMNT, TEST_CMNT_DEPR);
         run(tester, ARGS3, TEST_NODEPR, TEST_NOCMNT_NODEPR);