Skip to content

Commit

Permalink
Build: fix API differences between 201 and 202 in scratch tests
Browse files Browse the repository at this point in the history
  • Loading branch information
demiurg906 committed Nov 28, 2020
1 parent d50d56f commit 2a053c2
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 92 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -318,13 +318,16 @@ abstract class AbstractScratchRunActionTest : FileEditorManagerTestCase() {
}

override fun tearDown() {
// myFixture?.file?.virtualFile?.let {
// runWriteAction {
// if (it.isValid) {
// it.delete(this)
// }
// }
// }
super.tearDown()

VfsRootAccess.disallowRootAccess(KotlinTestUtils.getHomeDirectory())

ScratchFileService.getInstance().scratchesMapping.mappings.forEach { file, _ ->
runWriteAction { file.delete(this) }
}
}

companion object {
Expand Down Expand Up @@ -376,4 +379,4 @@ abstract class AbstractScratchRunActionTest : FileEditorManagerTestCase() {
}

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ package org.jetbrains.kotlin.idea.scratch

import com.intellij.ide.scratch.ScratchFileService
import com.intellij.ide.scratch.ScratchRootType
import com.intellij.lang.Language
import com.intellij.lang.PerFileMappingsEx
import com.intellij.openapi.actionSystem.AnAction
import com.intellij.openapi.actionSystem.CommonDataKeys
import com.intellij.openapi.module.Module
Expand All @@ -26,6 +24,7 @@ import org.jetbrains.kotlin.codegen.forTestCompile.ForTestCompileRuntime
import org.jetbrains.kotlin.idea.KotlinLanguage
import org.jetbrains.kotlin.idea.actions.KOTLIN_WORKSHEET_EXTENSION
import org.jetbrains.kotlin.idea.core.script.ScriptConfigurationManager
import org.jetbrains.kotlin.idea.debugger.coroutine.util.logger
import org.jetbrains.kotlin.idea.highlighter.KotlinHighlightingUtil
import org.jetbrains.kotlin.idea.scratch.actions.ClearScratchAction
import org.jetbrains.kotlin.idea.scratch.actions.RunScratchAction
Expand Down Expand Up @@ -323,9 +322,9 @@ abstract class AbstractScratchRunActionTest : FileEditorManagerTestCase() {

VfsRootAccess.disallowRootAccess(KotlinTestUtils.getHomeDirectory())

// (ScratchFileService.getInstance().scratchesMapping as PerFileMappingsEx<Language>).mappings.forEach { (file, _) ->
// runWriteAction { file.delete(this) }
// }
ScratchFileService.getInstance().scratchesMapping.mappings.forEach { file, _ ->
runWriteAction { file.delete(this) }
}
}

companion object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ package org.jetbrains.kotlin.idea.scratch
import com.intellij.codeInsight.daemon.LineMarkerInfo
import com.intellij.ide.scratch.ScratchFileService
import com.intellij.ide.scratch.ScratchRootType
import com.intellij.openapi.application.Application
import com.intellij.openapi.editor.Document
import com.intellij.openapi.fileEditor.FileEditorManager
import com.intellij.openapi.util.io.FileUtil
Expand Down Expand Up @@ -54,13 +55,8 @@ abstract class AbstractScratchLineMarkersTest : FileEditorManagerTestCase() {
val markers = doAndCheckHighlighting(document, data, File(path))

AbstractLineMarkersTest.assertNavigationElements(myFixture.project, myFixture.file as KtFile, markers)
}

override fun tearDown() {
super.tearDown()

ScratchFileService.getInstance().scratchesMapping.mappings.forEach { file, _ ->
runWriteAction { file.delete(this) }
runWriteAction {
scratchVirtualFile.delete(this)
}
}

Expand All @@ -72,4 +68,4 @@ abstract class AbstractScratchLineMarkersTest : FileEditorManagerTestCase() {
return AbstractLineMarkersTest.checkHighlighting(myFixture.file, documentToAnalyze, expectedHighlighting, expectedFile)
}

}
}

This file was deleted.

0 comments on commit 2a053c2

Please sign in to comment.