mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
test framework: extend case sensitive path comparing (IDEA-CR-6089)
This commit is contained in:
@@ -20,6 +20,7 @@ import com.intellij.openapi.application.WriteAction;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VfsUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
@@ -132,4 +133,16 @@ public class VfsTestUtil {
|
||||
}
|
||||
return vFile;
|
||||
}
|
||||
|
||||
public static void assertFilePathEndsWithCaseSensitivePath(@NotNull VirtualFile file, @NotNull String suffixPath) {
|
||||
String vfsSuffixPath = FileUtil.toSystemIndependentName(suffixPath);
|
||||
String vfsPath = file.getPath();
|
||||
if (!SystemInfo.isFileSystemCaseSensitive && !vfsPath.endsWith(vfsSuffixPath) &&
|
||||
StringUtil.endsWithIgnoreCase(vfsPath, vfsSuffixPath)) {
|
||||
String realSuffixPath = vfsPath.substring(vfsPath.length() - vfsSuffixPath.length());
|
||||
Assert.fail("Please correct case-sensitivity of path to prevent test failure on case-sensitive file systems:\n" +
|
||||
" path " + suffixPath + "\n" +
|
||||
"real path " + realSuffixPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
@@ -407,6 +407,7 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig
|
||||
fromVFile = myTempDirFixture.getFile(sourceFilePath);
|
||||
}
|
||||
Assert.assertNotNull("can't find test data file " + sourceFilePath + " (" + testDataPath + ")", fromVFile);
|
||||
VfsTestUtil.assertFilePathEndsWithCaseSensitivePath(fromVFile, sourceFilePath);
|
||||
result = myTempDirFixture.copyFile(fromVFile, targetPath);
|
||||
}
|
||||
else {
|
||||
@@ -1604,6 +1605,7 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig
|
||||
|
||||
final VirtualFile copy = LocalFileSystem.getInstance().refreshAndFindFileByPath(fullPath.replace(File.separatorChar, '/'));
|
||||
Assert.assertNotNull("file " + fullPath + " not found", copy);
|
||||
VfsTestUtil.assertFilePathEndsWithCaseSensitivePath(copy, filePath);
|
||||
return copy;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user