From 0d48daf0e658298601a9e4cfcb7deedd89e10e65 Mon Sep 17 00:00:00 2001 From: Kirill Likhodedov Date: Sat, 18 Mar 2017 11:35:21 +0000 Subject: [PATCH] vcs tests: refresh the created nested root to make it visible to VFS --- .../vcs/roots/VcsRootProblemNotifierTest.kt | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/platform/vcs-tests/testSrc/com/intellij/openapi/vcs/roots/VcsRootProblemNotifierTest.kt b/platform/vcs-tests/testSrc/com/intellij/openapi/vcs/roots/VcsRootProblemNotifierTest.kt index 5e54ae774c7e..a42f6ceeebe9 100644 --- a/platform/vcs-tests/testSrc/com/intellij/openapi/vcs/roots/VcsRootProblemNotifierTest.kt +++ b/platform/vcs-tests/testSrc/com/intellij/openapi/vcs/roots/VcsRootProblemNotifierTest.kt @@ -37,6 +37,7 @@ import com.intellij.openapi.vcs.VcsConfiguration import com.intellij.openapi.vcs.VcsRootChecker import com.intellij.openapi.vcs.changes.committed.MockAbstractVcs import com.intellij.openapi.vcs.roots.VcsRootPlatformTest.DOT_MOCK +import com.intellij.openapi.vfs.LocalFileSystem import com.intellij.vcs.test.VcsPlatformTest import com.intellij.vcsUtil.VcsUtil.getFilePath import java.io.File @@ -68,6 +69,8 @@ class VcsRootProblemNotifierTest : VcsPlatformTest() { } } + override fun getDebugLogCategories() = super.getDebugLogCategories().plus("#com.intellij.openapi.vcs.roots") + fun `test root is added automatically in simple case`() { assertTrue(File(myProjectPath, DOT_MOCK).mkdir()) @@ -78,9 +81,7 @@ class VcsRootProblemNotifierTest : VcsPlatformTest() { } fun `test nothing is added automatically if two roots detected`() { - assertTrue(File(myProjectPath, DOT_MOCK).mkdir()) - val subRoot = File(myProjectPath, "lib") - assertTrue(File(subRoot, DOT_MOCK).mkdirs()) + val subRoot = createNestedRoots() rootProblemNotifier.rescanAndNotifyIfNeeded() @@ -111,9 +112,7 @@ class VcsRootProblemNotifierTest : VcsPlatformTest() { // IDEA-CR-18592 fun `test single root is not added automatically if there is ignored root`() { - assertTrue(File(myProjectPath, DOT_MOCK).mkdir()) - val subRoot = File(myProjectPath, "lib") - assertTrue(File(subRoot, DOT_MOCK).mkdirs()) + val subRoot = createNestedRoots() VcsConfiguration.getInstance(myProject).addIgnoredUnregisteredRoots(listOf(FileUtil.toSystemIndependentName(subRoot.path))) rootProblemNotifier.rescanAndNotifyIfNeeded() @@ -125,6 +124,14 @@ class VcsRootProblemNotifierTest : VcsPlatformTest() { """.trimIndent()) } + private fun createNestedRoots(): File { + assertTrue(File(myProjectPath, DOT_MOCK).mkdir()) + val subRoot = File(myProjectPath, "lib") + assertTrue(File(subRoot, DOT_MOCK).mkdirs()) + LocalFileSystem.getInstance().refreshAndFindFileByIoFile(subRoot) + return subRoot + } + private fun getExtensionPoint() = Extensions.getRootArea().getExtensionPoint(VcsRootChecker.EXTENSION_POINT_NAME) private class MockRootChecker(private val vcs: MockAbstractVcs) : VcsRootChecker() {