align RootIndex.isProjectExcludeRoot with DirectoryIndexImpl

This commit is contained in:
peter
2013-11-23 14:51:19 +01:00
parent bd9bfa8e5d
commit 49939da2c0
3 changed files with 67 additions and 9 deletions
@@ -413,6 +413,9 @@ public class DirectoryIndexTest extends IdeaTestCase {
checkInfoNull(module2TestOutput);
assertFalse(myIndex.isProjectExcludeRoot(excluded));
assertTrue(myIndex.isProjectExcludeRoot(projectOutput));
assertTrue(myIndex.isProjectExcludeRoot(module2Output));
assertFalse(myIndex.isProjectExcludeRoot(module2TestOutput));
excluded.delete(this);
projectOutput.delete(this);
@@ -426,14 +429,34 @@ public class DirectoryIndexTest extends IdeaTestCase {
VirtualFile file = e.getFile();
checkInfoNull(file);
created.add(file);
String fileName = e.getFileName();
if (fileName.equals("projectOutput")) {
//todo fix and uncomment
// assertTrue(myIndex.isProjectExcludeRoot(file));
}
if (fileName.equals("module2Output")) {
//todo fix and uncomment
// assertTrue(myIndex.isProjectExcludeRoot(file));
}
if (fileName.equals("module2TestOutput")) {
assertFalse(myIndex.isProjectExcludeRoot(file));
}
}
};
VirtualFileManager.getInstance().addVirtualFileListener(l, getTestRootDisposable());
excluded = myModule1Dir.createChildDirectory(this, excluded.getName());
assertFalse(myIndex.isProjectExcludeRoot(excluded));
projectOutput = myModule1Dir.createChildDirectory(this, projectOutput.getName());
assertTrue(myIndex.isProjectExcludeRoot(projectOutput));
module2Output = myModule1Dir.createChildDirectory(this, module2Output.getName());
assertTrue(myIndex.isProjectExcludeRoot(module2Output));
module2TestOutput = myModule2Dir.createChildDirectory(this, module2TestOutput.getName());
assertFalse(myIndex.isProjectExcludeRoot(module2TestOutput));
checkInfoNull(excluded);
checkInfoNull(projectOutput);
@@ -443,6 +466,9 @@ public class DirectoryIndexTest extends IdeaTestCase {
assertEquals(created.toString(), 4, created.size());
assertFalse(myIndex.isProjectExcludeRoot(excluded));
assertTrue(myIndex.isProjectExcludeRoot(projectOutput));
assertTrue(myIndex.isProjectExcludeRoot(module2Output));
assertFalse(myIndex.isProjectExcludeRoot(module2TestOutput));
}
public void testExcludesShouldBeRecognizedRightOnRefresh() throws Exception {
@@ -539,6 +565,28 @@ public class DirectoryIndexTest extends IdeaTestCase {
assertTrue(myIndex.isProjectExcludeRoot(myOutputDir));
assertTrue(myIndex.isProjectExcludeRoot(myModule1OutputDir));
assertTrue(fileIndex.isIgnored(myModule1OutputDir));
PsiTestUtil.setCompilerOutputPath(myModule, moduleOutputUrl, true);
PsiTestUtil.setCompilerOutputPath(myModule2, moduleOutputUrl, false);
PsiTestUtil.setCompilerOutputPath(myModule2, moduleOutputUrl, true);
PsiTestUtil.setCompilerOutputPath(myModule3, moduleOutputUrl, false);
PsiTestUtil.setCompilerOutputPath(myModule3, moduleOutputUrl, true);
// now no module inherits project output dir, but it still should be project-excluded
assertTrue(myIndex.isProjectExcludeRoot(myOutputDir));
// project output inside module content shouldn't be projectExcludeRoot
VirtualFile projectOutputUnderContent = myModule1Dir.createChildDirectory(this, "projectOutputUnderContent");
getCompilerProjectExtension().setCompilerOutputUrl(projectOutputUnderContent.getUrl());
fireRootsChanged();
assertFalse(myIndex.isProjectExcludeRoot(myOutputDir));
//todo uncomment assertFalse(myIndex.isProjectExcludeRoot(projectOutputUnderContent));
projectOutputUnderContent.delete(this);
projectOutputUnderContent = myModule1Dir.createChildDirectory(this, "projectOutputUnderContent");
assertFalse(myIndex.isProjectExcludeRoot(myOutputDir));
//todo uncomment assertFalse(myIndex.isProjectExcludeRoot(projectOutputUnderContent));
}
private void checkInfo(VirtualFile dir,