Try to compare files in assertDirectoriesEqual() as text for better diff view

This commit is contained in:
Andrey Vlasovskikh
2011-05-04 17:10:43 +04:00
parent de9b9d69fc
commit a9134cd8a2
@@ -26,6 +26,7 @@ import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.Presentation;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.extensions.ExtensionPoint;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.openapi.extensions.Extensions;
@@ -499,7 +500,14 @@ public class PlatformTestUtil {
assertJarFilesEqual(VfsUtil.virtualToIoFile(fileAfter), VfsUtil.virtualToIoFile(fileBefore));
}
catch (IOException e) {
Assert.assertArrayEquals(fileAfter.getPath(), fileAfter.contentsToByteArray(), fileBefore.contentsToByteArray());
FileDocumentManager manager = FileDocumentManager.getInstance();
Document docBefore = manager.getDocument(fileBefore);
Document docAfter = manager.getDocument(fileAfter);
if (docBefore != null && docAfter != null) {
Assert.assertEquals(fileAfter.getPath(), docAfter.getText(), docBefore.getText());
} else {
Assert.assertArrayEquals(fileAfter.getPath(), fileAfter.contentsToByteArray(), fileBefore.contentsToByteArray());
}
}
}