You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by be...@apache.org on 2008/03/24 20:00:58 UTC

svn commit: r640523 - /maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/AbstractEclipsePluginTestCase.java

Author: bentmann
Date: Mon Mar 24 12:00:52 2008
New Revision: 640523

URL: http://svn.apache.org/viewvc?rev=640523&view=rev
Log:
o Fixed test to be insensitive to different line terminators

Modified:
    maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/AbstractEclipsePluginTestCase.java

Modified: maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/AbstractEclipsePluginTestCase.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/AbstractEclipsePluginTestCase.java?rev=640523&r1=640522&r2=640523&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/AbstractEclipsePluginTestCase.java (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/AbstractEclipsePluginTestCase.java Mon Mar 24 12:00:52 2008
@@ -517,6 +517,18 @@
                 expected = expected.replaceAll( "file:([a-zA-Z])", "file:/$1" );
             }
 
+            /*
+             * NOTE: This is another hack to compensate for some metadata files that contain a complete XML file as the
+             * value for a key like "org.eclipse.jdt.ui.formatterprofiles" from "org.eclipse.jdt.ui.prefs". Line
+             * terminators in this value are platform-dependent.
+             */
+            if ( !expected.equals( actual ) && expectedFile.getName().endsWith( ".prefs" ) )
+            {
+                // normalize line terminators
+                expected = expected.replaceAll( "(\\\\r\\\\n)|(\\\\n)|(\\\\r)", "\\n" );
+                actual = actual.replaceAll( "(\\\\r\\\\n)|(\\\\n)|(\\\\r)", "\\n" );
+            }
+
             assertEquals( "Checking " + filename + ", line #" + ( i + 1 ), expected, actual );
         }