From b45cf8967a73017505d40d201e602d2ed884d170 Mon Sep 17 00:00:00 2001 From: "Anna.Kozlova" Date: Tue, 7 Feb 2017 09:45:21 +0100 Subject: [PATCH] check for case sensitive fs --- .../intellij/codeInsight/CodeInsightTestCase.java | 5 +++++ .../LightPlatformCodeInsightTestCase.java | 12 +++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/java/testFramework/src/com/intellij/codeInsight/CodeInsightTestCase.java b/java/testFramework/src/com/intellij/codeInsight/CodeInsightTestCase.java index e10fbee71add..5111b4f81126 100644 --- a/java/testFramework/src/com/intellij/codeInsight/CodeInsightTestCase.java +++ b/java/testFramework/src/com/intellij/codeInsight/CodeInsightTestCase.java @@ -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); diff --git a/platform/testFramework/src/com/intellij/testFramework/LightPlatformCodeInsightTestCase.java b/platform/testFramework/src/com/intellij/testFramework/LightPlatformCodeInsightTestCase.java index 60f9b1a004f0..03f53a01aedc 100644 --- a/platform/testFramework/src/com/intellij/testFramework/LightPlatformCodeInsightTestCase.java +++ b/platform/testFramework/src/com/intellij/testFramework/LightPlatformCodeInsightTestCase.java @@ -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) {