6876782: two javadoc tests fail on Windows
authorjjg
Fri, 28 Aug 2009 12:12:08 -0700
changeset 3771 6e7b16ecca30
parent 3770 12d0e59df0fb
child 3772 b55aba011888
6876782: two javadoc tests fail on Windows Reviewed-by: darcy
langtools/test/com/sun/javadoc/lib/JavadocTester.java
langtools/test/com/sun/javadoc/testHtmlDefinitionListTag/TestHtmlDefinitionListTag.java
langtools/test/com/sun/javadoc/testSerializedFormDeprecationInfo/TestSerializedFormDeprecationInfo.java
--- 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
--- a/langtools/test/com/sun/javadoc/testHtmlDefinitionListTag/TestHtmlDefinitionListTag.java	Thu Aug 27 18:25:21 2009 -0700
+++ b/langtools/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/langtools/test/com/sun/javadoc/testSerializedFormDeprecationInfo/TestSerializedFormDeprecationInfo.java	Thu Aug 27 18:25:21 2009 -0700
+++ b/langtools/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);