check for case sensitive fs

This commit is contained in:
Anna.Kozlova
2017-02-07 09:49:38 +01:00
parent 80b791527c
commit b45cf8967a
2 changed files with 16 additions and 1 deletions
@@ -133,6 +133,9 @@ public abstract class CodeInsightTestCase extends PsiTestCase {
final VirtualFile[] vFiles = new VirtualFile[files.length];
for (int i = 0; i < files.length; i++) {
vFiles[i] = findVirtualFile(files[i]);
if (vFiles[i] != null) {
VfsTestUtil.assertFilePathEndsWithCaseSensitivePath(vFiles[i], files[i]);
}
}
File projectFile = projectRoot == null ? null : new File(getTestDataPath() + projectRoot);
@@ -454,6 +457,8 @@ public abstract class CodeInsightTestCase extends PsiTestCase {
PsiDocumentManager.getInstance(myProject).commitAllDocuments();
VirtualFile vFile = findVirtualFile(filePath);
VfsTestUtil.assertFilePathEndsWithCaseSensitivePath(vFile, filePath);
String ft;
try {
ft = VfsUtilCore.loadText(vFile);
@@ -113,7 +113,9 @@ public abstract class LightPlatformCodeInsightTestCase extends LightPlatformTest
*/
protected void configureByFile(@TestDataFile @NonNls @NotNull String filePath) {
try {
final File ioFile = new File(getTestDataPath() + filePath);
String fullPath = getTestDataPath() + filePath;
final File ioFile = new File(fullPath);
checkCaseSensitiveFS(fullPath, ioFile);
String fileText = FileUtilRt.loadFile(ioFile, CharsetToolkit.UTF8, true);
configureFromFileText(ioFile.getName(), fileText);
}
@@ -122,6 +124,13 @@ public abstract class LightPlatformCodeInsightTestCase extends LightPlatformTest
}
}
private static void checkCaseSensitiveFS(String fullPath, File ioFile) throws IOException {
fullPath = FileUtil.toSystemDependentName(FileUtil.toCanonicalPath(fullPath));
if (!ioFile.getCanonicalPath().equals(fullPath)) {
throw new RuntimeException("Search for: " + fullPath + "; but found: " + ioFile.getCanonicalPath());
}
}
@NonNls
@NotNull
protected String getTestDataPath() {
@@ -341,6 +350,7 @@ public abstract class LightPlatformCodeInsightTestCase extends LightPlatformTest
assertTrue(getMessage("Cannot find file " + fullPath, message), ioFile.exists());
String fileText;
try {
checkCaseSensitiveFS(fullPath, ioFile);
fileText = FileUtil.loadFile(ioFile, CharsetToolkit.UTF8_CHARSET);
}
catch (IOException e) {